summaryrefslogtreecommitdiff
path: root/builtin-remote.c
AgeCommit message (Collapse)Author
2008-11-18git-remote: add verbose mode to git remote updateCheng Renquan
Pass the verbose mode parameter to the underlying fetch command. $ ./git remote -v update Updating origin From git://git.kernel.org/pub/scm/git/git = [up to date] html -> origin/html = [up to date] maint -> origin/maint = [up to date] man -> origin/man = [up to date] master -> origin/master = [up to date] next -> origin/next = [up to date] pu -> origin/pu = [up to date] todo -> origin/todo Signed-off-by: Cheng Renquan <crquan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-17builtin-remote.c: plug a small memory leak in get_one_remote_for_updates()Junio C Hamano
We know that the string pointed at by remote->name won't change. It can be borrowed as the key in the string_list without copying. Other parts of existing code such as get_one_entry() already rely on this fact. Noticed by Cheng Renquan. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-17git-remote: match usage string with the manual pagesCheng Renquan
Signed-off-by: Cheng Renquan <crquan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-13Merge branch 'mv/remote-rename'Junio C Hamano
* mv/remote-rename: git-remote: document the migration feature of the rename subcommand git-remote rename: migrate from remotes/ and branches/ remote: add a new 'origin' variable to the struct Implement git remote rename
2008-11-12git-remote rename: migrate from remotes/ and branches/Miklos Vajna
Remote definition that came from $GIT_DIR/remotes/nick and $GIT_DIR/branches/nick are migrated to [remotes "nick"] section in the configuration file. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-11Merge branch 'maint'Junio C Hamano
* maint: Fix non-literal format in printf-style calls git-submodule: Avoid printing a spurious message. git ls-remote: make usage string match manpage Makefile: help people who run 'make check' by mistake
2008-11-11Fix non-literal format in printf-style callsDaniel Lowe
These were found using gcc 4.3.2-1ubuntu11 with the warning: warning: format not a string literal and no format arguments Incorporated suggestions from Brandon Casey <casey@nrlssc.navy.mil>. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-05Implement git remote renameMiklos Vajna
The new rename subcommand does the followings: 1) Renames the remote.foo configuration section to remote.bar 2) Updates the remote.bar.fetch refspecs 3) Updates the branch.*.remote settings 4) Renames the tracking branches: renames the normal refs and rewrites the symrefs to point to the new refs. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-05Merge branch 'mv/maint-branch-m-symref'Junio C Hamano
* mv/maint-branch-m-symref: update-ref --no-deref -d: handle the case when the pointed ref is packed git branch -m: forbid renaming of a symref Fix git update-ref --no-deref -d. rename_ref(): handle the case when the reflog of a ref does not exist Fix git branch -m for symrefs.
2008-10-26Fix git branch -m for symrefs.Miklos Vajna
This had two problems with symrefs. First, it copied the actual sha1 instead of the "pointer", second it failed to remove the old ref after a successful rename. Given that till now delete_ref() always dereferenced symrefs, a new parameters has been introduced to delete_ref() to allow deleting refs without a dereference. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-23git-remote: list branches in vertical listsJohannes Sixt
Previously, branches were listed on a single line in each section. But if there are many branches, then horizontal, line-wrapped lists are very inconvenient to scan for a human. This makes the lists vertical, i.e one branch per line is printed. Since "git remote" is porcelain, we can easily make this backwards-incompatible change. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-12Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializerBrandon Casey
Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable "foo" which has not been accessed since its declaration. These can be replaced with a static initialization using the STRBUF_INIT macro which is just as readable, saves a function call, and takes up fewer lines. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-09-29Merge branch 'mg/maint-remote-fix' into maintShawn O. Pearce
* mg/maint-remote-fix: make "git remote" report multiple URLs
2008-09-22git-remote: do not use user input in a printf format stringJohannes Sixt
'git remote show' substituted the remote name into a string that was later used as a printf format string. If a remote name contains a printf format specifier like this: $ git remote add foo%sbar . then the command $ git remote show foo%sbar would print garbage (if you are lucky) or crash. This fixes it. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-22make "git remote" report multiple URLsMichael J Gruber
This patch makes "git remote -v" and "git remote show" report multiple URLs rather than warn about them. Multiple URLs are OK for pushing into multiple repos simultaneously. Without "-v" each repo is shown once only. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-02clone: Add an option to set up a mirrorJohannes Schindelin
The command line $ git clone --mirror $URL is now a short-hand for $ git clone --bare $URL $ (cd $(basename $URL) && git remote add --mirror origin $URL) Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-22Rename path_list to string_listJohannes Schindelin
The name path_list was correct for the first usage of that data structure, but it really is a general-purpose string list. $ perl -i -pe 's/path-list/string-list/g' $(git grep -l path-list) $ perl -i -pe 's/path_list/string_list/g' $(git grep -l path_list) $ git mv path-list.h string-list.h $ git mv path-list.c string-list.c $ perl -i -pe 's/has_path/has_string/g' $(git grep -l has_path) $ perl -i -pe 's/path/string/g' string-list.[ch] $ git mv Documentation/technical/api-path-list.txt \ Documentation/technical/api-string-list.txt $ perl -i -pe 's/strdup_paths/strdup_strings/g' $(git grep -l strdup_paths) ... and then fix all users of string-list to access the member "string" instead of "path". Documentation/technical/api-string-list.txt needed some rewrapping, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-18builtin-remote.c: fix earlier "skip_prefix()" conversionJunio C Hamano
The original code relied on an insane definition of skip_prefix() that returned an empty string for a NULL input and returned the original if the given "prefix" is not a prefix at all (it would have been justifiable if it were called "come_up_with_a_short_name_to_report_ref()" or something, though). In any case, when we replaced it with a more saner definition of the function whose behaviour is true to its name, its callers needed to be adjusted but the conversion missed one call site. This introduces a helper function "abbrev_ref()" whose purpose is to get a full refname and its possible prefix and to strip the prefix part if it matches, or refname itself in full if it doesn't. This makes the callers easier to read again. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-01Move parse-options's skip_prefix() to git-compat-util.hMiklos Vajna
builtin-remote.c and parse-options.c both have a skip_prefix() function, for the same purpose. Move parse-options's one to git-compat-util.h and let builtin-remote use it as well. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-12"remote prune": be quiet when there is nothing to pruneJunio C Hamano
The previous commit made it always say "Pruning $remote" but reported the URL only when there is something to prune. Make it consistent by not saying anything at all when there is nothing to prune. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-11remote show: list tracked remote branches with -nOlivier Marin
Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-11remote prune: print the list of pruned branchesOlivier Marin
This command is really too quiet which make it unconfortable to use. Also implement a --dry-run option, in place of the original -n one, to list stale tracking branches that will be pruned, but do not actually prune them. Add a test case for --dry-run. Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-11builtin-remote: split show_or_prune() in two separate functionsOlivier Marin
This allow us to add different features to each of them and keep the code simple at the same time. Also create a get_remote_ref_states() to avoid duplicated code. Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-11remote show: fix the -n optionOlivier Marin
The perl version accepted a -n flag, to show local informations only without querying remote heads, that seems to have been lost in the C revrite. This restores the older behaviour and add a test case. Signed-off-by: Olivier Marin <dkr@freesurf.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-01Make "git-remote rm" delete refs acccording to fetch specsShawn O. Pearce
A remote may be configured to fetch into tracking branches that don't match its name. A user may have created a remote by hand that will fetch to a different tracking branch namespace: [remote "alt"] url = git://repo.or.cz/alt-git.git fetch = refs/heads/*:refs/remotes/origin/* When deleting remote alt we should clean up the refs whose names start with "refs/remotes/origin/", even though the remote itself was named alt by the user. To avoid deleting refs used by another remote we only clear refs that are unique to this remote. This prevents `git prune rm alt` from removing the refs used by say origin if alt was just using a different URL for the same repository. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-01Make "git-remote prune" delete refs according to fetch specsShawn O. Pearce
A remote may be configured to fetch into tracking branches that do not match the remote name. For example a user may have created extra remotes that will fetch to the same tracking branch namespace, but from different URLs: [remote "origin"] url = git://git.kernel.org/pub/scm/git/git.git fetch = refs/heads/*:refs/remotes/origin/* [remote "alt"] url = git://repo.or.cz/alt-git.git fetch = refs/heads/*:refs/remotes/origin/* When running `git remote prune alt` we expect stale branches to be removed from "refs/remotes/origin/*" and not from the unused namespace of "refs/remotes/alt/*". Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-01Remove unused remote_prefix member in builtin-remoteShawn O. Pearce
Not sure when this became unused, but no code references it, other than to populate the strbuf with an initial value. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-14Provide git_config with a callback-data parameterJohannes Schindelin
git_config() only had a function parameter, but no callback data parameter. This assumes that all callback functions only modify global variables. With this patch, every callback gets a void * parameter, and it is hoped that this will help the libification effort. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-06Merge branch 'pb/remote-mirror-config'Junio C Hamano
* pb/remote-mirror-config: Add a remote.*.mirror configuration option
2008-04-25Merge branch 'maint'Junio C Hamano
* maint: remote: create fetch config lines with '+' push: allow unqualified dest refspecs to DWIM doc/git-gc: add a note about what is collected t5516: remove ambiguity test (1) Linked glossary from cvs-migration page write-tree: properly detect failure to write tree objects
2008-04-25remote: create fetch config lines with '+'Jeff King
Since git-remote always uses remote tracking branches, it should be safe to always force updates of those branches. I.e., we should generate fetch = +refs/heads/*:refs/remotes/$remote/* instead of fetch = refs/heads/*:refs/remotes/$remote/* This was the behavior of the perl version, which seems to have been lost in the C rewrite. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-21Add a remote.*.mirror configuration optionPaolo Bonzini
This patch adds a remote.*.mirror configuration option that, when set, automatically puts git-push in --mirror mode for that remote. Furthermore, the option is set automatically by `git remote add --mirror'. The code in remote.c to parse remote.*.skipdefaultupdate had a subtle problem: a comment in the code indicated that special care was needed for boolean options, but this care was not used in parsing the option. Since I was touching related code, I did this fix too. [jc: and I further fixed up the "ignore boolean" code.] Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-20Merge branch 'jk/remote-default-show'Junio C Hamano
* jk/remote-default-show: git-remote: show all remotes with "git remote show"
2008-04-18git-remote: reject adding remotes with invalid namesJonas Fonseca
This can happen if the arguments to git-remote add is switched by the user, and git would only show an error if fetching was also requested. Fix it by using the refspec parsing engine to check if the requested name can be parsed as a remote before add it. Also cleanup so that the "remote.<name>.url" config name buffer is only initialized once. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-10git-remote: show all remotes with "git remote show"Jeff King
Many other commands use the "no arguments" form to show a list (e.g., git-branch, git-tag). While we did show all remotes for just "git remote", we displayed a usage error for "git remote show" with no arguments. This is counterintuitive, since by giving it _more_ information, we get _less_ result. The usage model can now be thought of as: - "git remote show <remote>": show a remote - "git remote show": show all remotes - "git remote": assume "show"; i.e., shorthand for "git remote show" Signed-off-by: Jeff King <peff@peff.net> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-24builtin-remote: Fix missing newline at end of listing of pushed branchesJohannes Sixt
Without this the output of 'git remote show' does not end with a new-line: bash> git remote show repo * remote repo URL: repo.or.cz:/srv/git/kdbg.git Tracked remote branches maint master mob Local branch pushed with 'git push' +master:masterbash> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-20remote show: do not show symbolic refsJohannes Schindelin
For symbolic refs, a sane notion of being "stale" is that the ref they point to no longer exists. Since this is checked already, "remote show" does not need to show them at all. Incidentally, this fixes the issue that "HEAD" was shown as a stale ref by "remote show" in a freshly cloned repository. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-12"remote update": print remote name being fetched fromSamuel Tardieu
When the other end has dangling symref, "git fetch" issues an error message but that is not grave enough to cause the fetch process to fail. As the result, the user will see something like this: $ git remote update error: refs/heads/2.0-uobjects points nowhere! "remote update" used to report which remote it is fetching from, like this: $ git remote update Updating core Updating matthieu error: refs/heads/2.0-uobjects points nowhere! Updating origin This reinstates the message "Updating <name>" in "git remote update". Signed-off-by: Samuel Tardieu <sam@rfc1149.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-09builtin remote rm: remove symbolic refs, tooJohannes Schindelin
"git remote add" can add a symbolic ref "HEAD", and "rm" should delete it, too. Noticed by Teemu Likonen. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-05remote: fix "update [group...]"Johannes Schindelin
The rewrite in C inadvertently broke updating with remote groups: when you pass parameters to "git remote update", it used to look up "remotes.<group>" for every parameter, and interpret the value as a list of remotes to update. Also, no parameter, or a single parameter "default" should update all remotes that have not been marked with "skipDefaultUpdate". Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-02remote show: Clean up connection correctly if object fetch wasn't doneJohannes Schindelin
Like in ls-remote, we have to disconnect the transport after getting the remote refs. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01builtin-remote: prune remotes correctly that were added with --mirrorJohannes Schindelin
This adds special handling for mirror remotes. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-01Make git-remote a builtinJohannes Schindelin
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>