aboutsummaryrefslogtreecommitdiff
path: root/builtin/remote.c
Commit message (Collapse)AuthorAge
...
| * refs.c: add an err argument to repack_without_refsRonnie Sahlberg2014-07-14
| | | | | | | | | | | | | | | | | | | | | | Update repack_without_refs to take an err argument and update it if there is a failure. Pass the err variable from ref_transaction_commit to this function so that callers can print a meaningful error message if _commit fails due to this function. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
* | Merge branch 'jk/strip-suffix'Junio C Hamano2014-07-16
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jk/strip-suffix: prepare_packed_git_one: refactor duplicate-pack check verify-pack: use strbuf_strip_suffix strbuf: implement strbuf_strip_suffix index-pack: use strip_suffix to avoid magic numbers use strip_suffix instead of ends_with in simple cases replace has_extension with ends_with implement ends_with via strip_suffix add strip_suffix function sha1_file: replace PATH_MAX buffer with strbuf in prepare_packed_git_one()
| * | use strip_suffix instead of ends_with in simple casesJeff King2014-06-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When stripping a suffix like: if (ends_with(str, "foo")) buf = xmemdupz(str, strlen(str) - 3); we can instead use strip_suffix to avoid the constant 3, which must match the literal "foo" (we sometimes use strlen("foo") instead, but that means we are repeating ourselves). The example above becomes: if (strip_suffix(str, "foo", &len)) buf = xmemdupz(str, len); This also saves a strlen(), since we calculate the string length when detecting the suffix. Note that in some cases we also switch from xstrndup to xmemdupz, which saves a further strlen call. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | refactor skip_prefix to return a booleanJeff King2014-06-20
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The skip_prefix() function returns a pointer to the content past the prefix, or NULL if the prefix was not found. While this is nice and simple, in practice it makes it hard to use for two reasons: 1. When you want to conditionally skip or keep the string as-is, you have to introduce a temporary variable. For example: tmp = skip_prefix(buf, "foo"); if (tmp) buf = tmp; 2. It is verbose to check the outcome in a conditional, as you need extra parentheses to silence compiler warnings. For example: if ((cp = skip_prefix(buf, "foo")) /* do something with cp */ Both of these make it harder to use for long if-chains, and we tend to use starts_with() instead. However, the first line of "do something" is often to then skip forward in buf past the prefix, either using a magic constant or with an extra strlen(3) (which is generally computed at compile time, but means we are repeating ourselves). This patch refactors skip_prefix() to return a simple boolean, and to provide the pointer value as an out-parameter. If the prefix is not found, the out-parameter is untouched. This lets you write: if (skip_prefix(arg, "foo ", &arg)) do_foo(arg); else if (skip_prefix(arg, "bar ", &arg)) do_bar(arg); Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jl/remote-rm-prune'Junio C Hamano2014-06-16
|\ \ | |/ | | | | | | | | | | | | | | | | | | "git remote rm" and "git remote prune" can involve removing many refs at once, which is not a very efficient thing to do when very many refs exist in the packed-refs file. * jl/remote-rm-prune: remote prune: optimize "dangling symref" check/warning remote: repack packed-refs once when deleting multiple refs remote rm: delete remote configuration as the last
| * remote prune: optimize "dangling symref" check/warningJens Lindström2014-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When 'git remote prune' was used to delete many refs in a repository with many refs, a lot of time was spent checking for (now) dangling symbolic refs pointing to the deleted ref, since warn_dangling_symref() was once per deleted ref to check all other refs in the repository. Avoid this using the new warn_dangling_symrefs() function which makes one pass over all refs and checks for all the deleted refs in one go, after they have all been deleted. Signed-off-by: Jens Lindström <jl@opera.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * remote: repack packed-refs once when deleting multiple refsJens Lindström2014-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When 'git remote rm' or 'git remote prune' were used in a repository with many refs, and needed to delete many remote-tracking refs, a lot of time was spent deleting those refs since for each deleted ref, repack_without_refs() was called to rewrite packed-refs without just that deleted ref. To avoid this, call repack_without_refs() first to repack without all the refs that will be deleted, before calling delete_ref() to delete each one completely. The call to repack_without_ref() in delete_ref() then becomes a no-op, since packed-refs already won't contain any of the deleted refs. Signed-off-by: Jens Lindström <jl@opera.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * remote rm: delete remote configuration as the lastJens Lindström2014-05-23
| | | | | | | | | | | | | | | | | | | | When removing a remote, delete the remote-tracking branches before deleting the remote configuration. This way, if the operation fails or is aborted while deleting the remote-tracking branches, the command can be rerun to complete the operation. Signed-off-by: Jens Lindström <jl@opera.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | builtin/remote.c: rearrange xcalloc argumentsBrian Gesiak2014-05-27
|/ | | | | | | | | | | xcalloc() takes two arguments: the number of elements and their size. builtin/remote.c includes several calls to xcalloc() that pass the arguments in reverse order. Rearrange them so they are in the correct order. Signed-off-by: Brian Gesiak <modocache@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'cc/starts-n-ends-with'Junio C Hamano2013-12-17
|\ | | | | | | | | | | | | | | | | | | | | Remove a few duplicate implementations of prefix/suffix comparison functions, and rename them to starts_with and ends_with. * cc/starts-n-ends-with: replace {pre,suf}fixcmp() with {starts,ends}_with() strbuf: introduce starts_with() and ends_with() builtin/remote: remove postfixcmp() and use suffixcmp() instead environment: normalize use of prefixcmp() by removing " != 0"
| * replace {pre,suf}fixcmp() with {starts,ends}_with()Christian Couder2013-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Leaving only the function definitions and declarations so that any new topic in flight can still make use of the old functions, replace existing uses of the prefixcmp() and suffixcmp() with new API functions. The change can be recreated by mechanically applying this: $ git grep -l -e prefixcmp -e suffixcmp -- \*.c | grep -v strbuf\\.c | xargs perl -pi -e ' s|!prefixcmp\(|starts_with\(|g; s|prefixcmp\(|!starts_with\(|g; s|!suffixcmp\(|ends_with\(|g; s|suffixcmp\(|!ends_with\(|g; ' on the result of preparatory changes in this series. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * builtin/remote: remove postfixcmp() and use suffixcmp() insteadChristian Couder2013-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 8cc5b290 (git merge -X<option>, 25 Nov 2009) introduced suffixcmp() with nearly the same implementation as postfixcmp() that already existed since commit 211c8968 (Make git-remote a builtin, 29 Feb 2008). The only difference between the two implementations is that, when the string is smaller than the suffix, one implementation returns 1 while the other one returns -1. But, as postfixcmp() is only used to compare for equality, the distinction does not matter and does not affect the correctness of this patch. As postfixcmp() has always been static in builtin/remote.c and is used nowhere else, it makes more sense to remove it and use suffixcmp() instead in builtin/remote.c, rather than to remove suffixcmp(). Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'fc/trivial'Junio C Hamano2013-12-17
|\ \ | | | | | | | | | | | | | | | | | | | | | * fc/trivial: remote: fix status with branch...rebase=preserve fetch: add missing documentation t: trivial whitespace cleanups abspath: trivial style fix
| * | remote: fix status with branch...rebase=preserveFelipe Contreras2013-12-09
| |/ | | | | | | | | | | | | | | | | Commit 66713ef (pull: allow pull to preserve merges when rebasing) didn't include an update so 'git remote status' parses branch.<name>.rebase=preserve correctly, let's do that. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | fetch, remote: properly convey --no-prune options to subprocessesMichael Haggerty2013-10-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If --no-prune is passed to one of the following commands: git fetch --all git fetch --multiple git fetch --recurse-submodules git remote update then it must also be passed to the "fetch" subprocesses that those commands use to do their work. Otherwise there might be a fetch.prune or remote.<name>.prune configuration setting that causes pruning to occur, contrary to the user's express wish. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | builtin/remote.c:update(): use struct argv_arrayMichael Haggerty2013-10-30
| | | | | | | | | | | | | | Use struct argv_array for calling the "git fetch" subprocesses. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | builtin/remote.c: reorder function definitionsMichael Haggerty2013-10-30
|/ | | | | | | | Reorder function definitions to remove the need for forward declarations. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'po/remote-set-head-usage'Jonathan Nieder2013-10-14
|\ | | | | | | | | | | * po/remote-set-head-usage: remote set-head -h: add long options to synopsis remote doc: document long forms of set-head options
| * remote set-head -h: add long options to synopsisPhilip Oakley2013-09-27
| | | | | | | | | | | | | | | | Document --auto and --delete alongside their short forms -a and -d in the first line of 'git remote set-head -h' output. Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
* | Replace deprecated OPT_BOOLEAN by OPT_BOOLStefan Beller2013-08-05
|/ | | | | | | | | | | | This task emerged from b04ba2bb (parse-options: deprecate OPT_BOOLEAN, 2011-09-27). All occurrences of the respective variables have been reviewed and none of them relied on the counting up mechanism, but all of them were using the variable as a true boolean. This patch does not change semantics of any command intentionally. Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* remote: check for superfluous arguments in 'git remote add'Thomas Rast2013-04-24
| | | | | | | | The 'git remote add' subcommand did not check for superfluous command line arguments. Make it so. Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix typo in remote set-head usageAntoine Pelisse2012-11-26
| | | | | | | | parenthesis are not matching in `builtin_remote_sethead_usage` as a square bracket is closing something never opened. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'nd/maint-remote-remove'Junio C Hamano2012-09-12
|\ | | | | | | | | * nd/maint-remote-remove: remote: prefer subcommand name 'remove' to 'rm'
| * remote: prefer subcommand name 'remove' to 'rm'Nguyễn Thái Ngọc Duy2012-09-06
| | | | | | | | | | | | | | | | | | | | | | | | All remote subcommands are spelled out words except 'rm'. 'rm', being a popular UNIX command name, may mislead users that there are also 'ls' or 'mv'. Use 'remove' to fit with the rest of subcommands. 'rm' is still supported and used in the test suite. It's just not widely advertised. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | i18n: remote: mark parseopt strings for translationNguyễn Thái Ngọc Duy2012-08-20
|/ | | | | Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* remote: fix typoRalf Thielow2012-05-20
| | | | | | | | The mapping that describe what ref fetched from the remote is used to update what ref locally is called "refspec", not "respec". Signed-off-by: Ralf Thielow <ralf.thielow@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'nd/i18n'Junio C Hamano2012-05-02
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More message strings marked for i18n. By Nguyễn Thái Ngọc Duy (10) and Jonathan Nieder (1) * nd/i18n: help: replace underlining "help -a" headers using hyphens with a blank line i18n: bundle: mark strings for translation i18n: index-pack: mark strings for translation i18n: apply: update say_patch_name to give translators complete sentence i18n: apply: mark strings for translation i18n: remote: mark strings for translation i18n: make warn_dangling_symref() automatically append \n i18n: help: mark strings for translation i18n: mark relative dates for translation strbuf: convenience format functions with \n automatically appended Makefile: feed all header files to xgettext
| * i18n: remote: mark strings for translationNguyễn Thái Ngọc Duy2012-04-24
| | | | | | | | | | Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * i18n: make warn_dangling_symref() automatically append \nNguyễn Thái Ngọc Duy2012-04-24
| | | | | | | | | | | | | | This helps remove \n from translatable strings Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ms/remote-usage-string'Junio C Hamano2012-04-23
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | Adds some subcommands that were not listed in "git remote --help" usage strings. As an independent follow-up, we may want to rethink how the overall usage string and subcommand usage strings are maintained. By Michael Schubert * ms/remote-usage-string: remote: update builtin usage
| * remote: update builtin usageMichael Schubert2012-04-09
| | | | | | | | | | | | | | Add missing options "--tags|--no-tags" and "--push". Signed-off-by: Michael Schubert <mschub@elegosoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Merge branch 'pj/remote-set-branches-usage-fix' into maintJunio C Hamano2012-02-27
| |\ | | | | | | | | | | | | | | | | | | | | | * pj/remote-set-branches-usage-fix: remote: fix set-branches usage and documentation Conflicts: builtin/remote.c
* | \ Merge branch 'pj/remote-set-branches-usage-fix'Junio C Hamano2012-02-23
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | * pj/remote-set-branches-usage-fix: remote: fix set-branches usage and documentation Conflicts: builtin/remote.c
| * | remote: fix set-branches usage and documentationPhilip Jägenstedt2012-02-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | The canonical order of command line arguments is always to have dashed commands before other parameters, but the "git remote set-branches" subcommand was described to take "name" before an optional "--add". Signed-off-by: Philip Jägenstedt <philip@foolip.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'nd/maint-refname-in-hierarchy-check'Junio C Hamano2012-01-29
|\ \ \ | |_|/ |/| | | | | | | | * nd/maint-refname-in-hierarchy-check: Fix incorrect ref namespace check
| * | Fix incorrect ref namespace checkNguyễn Thái Ngọc Duy2012-01-11
| | | | | | | | | | | | | | | | | | | | | | | | The reason why the trailing slash is needed is obvious. refs/stash and HEAD are not namespace, but complete refs. Do full string compare on them. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Rename resolve_ref() to resolve_ref_unsafe()Nguyễn Thái Ngọc Duy2011-12-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | resolve_ref() may return a pointer to a shared buffer and can be overwritten by the next resolve_ref() calls. Callers need to pay attention, not to keep the pointer when the next call happens. Rename with "_unsafe" suffix to warn developers (or reviewers) before introducing new call sites. This patch is generated using the following command git grep -l 'resolve_ref(' -- '*.[ch]'|xargs sed -i 's/resolve_ref(/resolve_ref_unsafe(/g' Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Convert many resolve_ref() calls to read_ref*() and ref_exists()Nguyễn Thái Ngọc Duy2011-11-13
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | resolve_ref() may return a pointer to a static buffer, which is not safe for long-term use because if another resolve_ref() call happens, the buffer may be changed. Many call sites though do not care about this buffer. They simply check if the return value is NULL or not. Convert all these call sites to new wrappers to reduce resolve_ref() calls from 57 to 34. If we change resolve_ref() prototype later on to avoid passing static buffer out, this helps reduce changes. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jc/remote-setbranches-usage-fix'Junio C Hamano2011-11-08
|\ \ | |/ | | | | | | * jc/remote-setbranches-usage-fix: remote: fix set-branches usage
| * remote: fix set-branches usageJunio C Hamano2011-11-06
| | | | | | | | | | | | | | | | | | Bad copy-paste. Otherwise "git remote set-branches" without necessary argument will result in an error message and help for set-url subcommand. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'fc/remote-seturl-usage-fix'Junio C Hamano2011-11-08
| | | | | | | | | | * fc/remote-seturl-usage-fix: remote: fix remote set-url usage
* | Merge branch 'cn/fetch-prune'Junio C Hamano2011-10-26
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cn/fetch-prune: fetch: treat --tags like refs/tags/*:refs/tags/* when pruning fetch: honor the user-provided refspecs when pruning refs remote: separate out the remote_find_tracking logic into query_refspecs t5510: add tests for fetch --prune fetch: free all the additional refspecs Conflicts: remote.c
| * | fetch: honor the user-provided refspecs when pruning refsCarlos Martín Nieto2011-10-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the user gave us refspecs on the command line, we should use those when deciding whether to prune a ref instead of relying on the refspecs in the config. Previously, running git fetch --prune origin refs/heads/master:refs/remotes/origin/master would delete every other ref under the origin namespace because we were using the refspec to filter the available refs but using the configured refspec to figure out if a ref had been deleted on the remote. This is clearly the wrong thing to do. Change prune_refs and get_stale_heads to simply accept a list of references and a list of refspecs. The caller of either function needs to decide what refspecs should be used to decide whether a ref is stale. Signed-off-by: Carlos Martín Nieto <cmn@elego.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/match-refs-clarify'Junio C Hamano2011-10-21
|\ \ \ | | | | | | | | | | | | | | | | | | | | * jc/match-refs-clarify: rename "match_refs()" to "match_push_refs()" send-pack: typofix error message
| * | | rename "match_refs()" to "match_push_refs()"Junio C Hamano2011-09-12
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Yes, there is a warning that says the function is only used by push in big red letters in front of this function, but it didn't say a more important thing it should have said: what the function is for and what it does. Rename it and document it to avoid future confusion. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'mz/remote-rename'Junio C Hamano2011-10-10
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | * mz/remote-rename: remote: only update remote-tracking branch if updating refspec remote rename: warn when refspec was not updated remote: "rename o foo" should not rename ref "origin/bar" remote: write correct fetch spec when renaming remote 'remote'
| * | remote: only update remote-tracking branch if updating refspecMartin von Zweigbergk2011-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'git remote rename' will only update the remote's fetch refspec if it looks like a default one. If the remote has no default fetch refspec, as in [remote "origin"] url = git://git.kernel.org/pub/scm/git/git.git fetch = +refs/heads/*:refs/remotes/upstream/* we would not update the fetch refspec and even if there is a ref called "refs/remotes/origin/master", we should not rename it, since it was not created by fetching from the remote. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote rename: warn when refspec was not updatedMartin von Zweigbergk2011-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When renaming a remote, we also try to update the fetch refspec accordingly, but only if it has the default format. For others, such as refs/heads/master:refs/heads/origin, we are conservative and leave it untouched. Let's give the user a warning about refspecs that are not updated, so he can manually update the config if necessary. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote: "rename o foo" should not rename ref "origin/bar"Martin von Zweigbergk2011-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When renaming a remote called 'o' using 'git remote rename o foo', git should also rename any remote-tracking branches for the remote. This does happen, but any remote-tracking branches starting with 'refs/remotes/o', such as 'refs/remotes/origin/bar', will also be renamed (to 'refs/remotes/foorigin/bar' in this case). Fix it by simply matching one more character, up to the slash following the remote name. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote: write correct fetch spec when renaming remote 'remote'Martin von Zweigbergk2011-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When renaming a remote whose name is contained in a configured fetch refspec for that remote, we currently replace the first occurrence of the remote name in the refspec. This is correct in most cases, but breaks if the remote name occurs in the fetch refspec before the expected place. For example, we currently change [remote "remote"] url = git://git.kernel.org/pub/scm/git/git.git fetch = +refs/heads/*:refs/remotes/remote/* into [remote "origin"] url = git://git.kernel.org/pub/scm/git/git.git fetch = +refs/heads/*:refs/origins/remote/* Reduce the risk of changing incorrect sections of the refspec by matching the entire ":refs/remotes/<name>/" instead of just "<name>". Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>