RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1207253 - "git submodule add -f URL PATH" doesn't work despite git suggests it
Summary: "git submodule add -f URL PATH" doesn't work despite git suggests it
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: git
Version: 6.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Petr Stodulka
QA Contact: Andrej Dzilský
URL:
Whiteboard:
Depends On:
Blocks: 1254457 1355829 1359264
TreeView+ depends on / blocked
 
Reported: 2015-03-30 14:02 UTC by Jan Pokorný [poki]
Modified: 2017-03-21 10:00 UTC (History)
3 users (show)

Fixed In Version: git-1.7.1-8.el6
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2017-03-21 10:00:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch (1.77 KB, patch)
2015-03-30 20:55 UTC, Petr Stodulka
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0640 0 normal SHIPPED_LIVE git bug fix update 2017-03-21 12:31:15 UTC

Description Jan Pokorný [poki] 2015-03-30 14:02:50 UTC
Demo of the issue:

$ pushd /tmp
> /tmp
$ git clone https://github.com/richardfontana/copyleft-next.git
> Initialized empty Git repository in /tmp/copyleft-next/.git/
> remote: Counting objects: 2306, done.
> remote: Total 2306 (delta 0), reused 0 (delta 0), pack-reused 2306
> Receiving objects: 100% (2306/2306), 508.83 KiB | 606 KiB/s, done.
> Resolving deltas: 100% (1127/1127), done.
$ cd copyleft-next
$ echo "/example-project" > .gitignore
$ git submodule add -- https://github.com/creativecommons/example-project.git example-project
> Initialized empty Git repository in /tmp/copyleft-next/example-project/.git/
> remote: Counting objects: 13, done.
> remote: Total 13 (delta 0), reused 0 (delta 0), pack-reused 13
> Unpacking objects: 100% (13/13), done.
> The following paths are ignored by one of your .gitignore files:
> example-project
> Use -f if you really want to add them.
> fatal: no files added
> Failed to add submodule 'example-project'

(Ok, will use -f as I "really want to add them")

$ git submodule add -f -- https://github.com/creativecommons/example-project.git example-project
> Usage: git submodule [--quiet] add [-b branch] [--reference <repository>] [--] <repository> [<path>]
>    or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
>    or: git submodule [--quiet] init [--] [<path>...]
>    or: git submodule [--quiet] update [--init] [-N|--no-fetch] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
>    or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
>    or: git submodule [--quiet] foreach [--recursive] <command>
>    or: git submodule [--quiet] sync [--] [<path>...]

Ouch.  This works nicely with newer versions of git, though.

$ rpm -q git
git-1.7.1-3.el6_4.1.x86_64

Comment 2 Petr Stodulka 2015-03-30 20:55:04 UTC
Created attachment 1008666 [details]
Patch

Upstream patch. Force option missed in git-submodules.sh

Comment 6 Petr Stodulka 2016-12-07 23:38:38 UTC
Moved back to assigned because of found bug by Martin Cermak (#1401872). We overlooked that option --ignore-missing for "add" subcommand doesn't exist in git v1.7.1 so import of new submodules were not possible without --force option.

Correct solution without futile clone of the module when it can't be imported
is bigger for implementation (upstream creates more fixes because of this option) - and probably time consuming for correct testing, proposed solution removes problematic check (without this --ignore-missing option, we can't do that reasonably).

So when user doesn't use -f or --force option and file is on a .gitignore list, user will see erro message as above to use -f option, but module will be already downloaded in the repo.

With -f or --force option a modul will be correctly added in that case.
(Hope that my explanation is clear.)

Comment 8 Andrej Dzilský 2016-12-14 16:31:54 UTC
Current solution works as intented.

Comment 10 errata-xmlrpc 2017-03-21 10:00:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0640.html


Note You need to log in before you can comment on or make changes to this bug.