summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2013-07-01Merge branch 'jc/topo-author-date-sort'Libravatar Junio C Hamano2-7/+9
"git log" learned the "--author-date-order" option, with which the output is topologically sorted and commits in parallel histories are shown intermixed together based on the author timestamp. * jc/topo-author-date-sort: t6003: add --author-date-order test topology tests: teach a helper to set author dates as well t6003: add --date-order test topology tests: teach a helper to take abbreviated timestamps t/lib-t6000: style fixes log: --author-date-order sort-in-topological-order: use prio-queue prio-queue: priority queue of pointers to structs toposort: rename "lifo" field
2013-06-30Merge branch 'mh/ref-races'Libravatar Junio C Hamano2-6/+11
"git pack-refs" that races with new ref creation or deletion have been susceptible to lossage of refs under right conditions, which has been tightened up. * mh/ref-races: for_each_ref: load all loose refs before packed refs get_packed_ref_cache: reload packed-refs file when it changes add a stat_validity struct Extract a struct stat_data from cache_entry packed_ref_cache: increment refcount when locked do_for_each_entry(): increment the packed refs cache refcount refs: manage lifetime of packed refs cache via reference counting refs: implement simple transactions for the packed-refs file refs: wrap the packed refs cache in a level of indirection pack_refs(): split creation of packed refs and entry writing repack_without_ref(): split list curation and entry writing
2013-06-30Merge branch 'nk/name-rev-abbreviated-refs'Libravatar Junio C Hamano1-7/+29
"git name-rev --refs=tags/v*" were forbidden, which was a bit inconvenient (you had to give a pattern to match refs fully, like --refs=refs/tags/v*). * nk/name-rev-abbreviated-refs: name-rev: allow to specify a subpath for --refs option
2013-06-30Merge branch 'jk/submodule-subdirectory-ok'Libravatar Junio C Hamano1-5/+19
Allow various subcommands of "git submodule" to be run not from the top of the working tree of the superproject. * jk/submodule-subdirectory-ok: submodule: drop the top-level requirement rev-parse: add --prefix option submodule: show full path in error message t7403: add missing && chaining t7403: modernize style t7401: make indentation consistent
2013-06-27Merge branch 'bc/checkout-tracking-name-plug-leak'Libravatar Junio C Hamano1-2/+5
Plug a small leak in checkout. * bc/checkout-tracking-name-plug-leak: t/t9802: explicitly name the upstream branch to use as a base builtin/checkout.c: don't leak memory in check_tracking_name
2013-06-26Merge branch 'tr/maint-apply-non-git-patch-parsefix'Libravatar Junio C Hamano1-1/+1
Fix for the codepath to parse patches that add new files, generated by programs other than Git. THis is an old breakage in v1.7.11 and will need to be merged down to the maintanance tracks. * tr/maint-apply-non-git-patch-parsefix: apply: carefully strdup a possibly-NULL name
2013-06-26Merge branch 'ph/builtin-srcs-are-in-subdir-these-days'Libravatar Junio C Hamano3-4/+2
* ph/builtin-srcs-are-in-subdir-these-days: fix "builtin-*" references to be "builtin/*"
2013-06-24Merge branch 'mm/rm-coalesce-errors'Libravatar Junio C Hamano1-19/+82
Give a single message followed by list of paths from "git rm" to report multiple paths that cannot be removed. * mm/rm-coalesce-errors: rm: introduce advice.rmHints to shorten messages rm: better error message on failure for multiple files
2013-06-24Merge branch 'jh/libify-note-handling'Libravatar Junio C Hamano2-133/+6
Make it possible to call into copy-notes API from the sequencer code. * jh/libify-note-handling: Move create_notes_commit() from notes-merge.c into notes-utils.c Move copy_note_for_rewrite + friends from builtin/notes.c to notes-utils.c finish_copy_notes_for_rewrite(): Let caller provide commit message
2013-06-24Revert "Merge branch 'jg/status-config'"Libravatar Junio C Hamano1-11/+0
This reverts commit 1a22bd31f0a5130ce6c934951a5526ceb774c2be, reversing changes made to 3e7a5b489e45ae8a3a0b222893d58b172d883136. It makes it impossible to "git commit" when status.short is set, and also "git status --porcelain" output is affected by status.branch.
2013-06-23Merge branch 'jg/status-config'Libravatar Junio C Hamano1-0/+11
"git status" learned status.branch and status.short configuration variables to use --branch and --short options by default (override with --no-branch and --no-short options from the command line). * jg/status-config: status: introduce status.branch to enable --branch by default status: introduce status.short to enable --short by default
2013-06-21apply: carefully strdup a possibly-NULL nameLibravatar Thomas Rast1-1/+1
2901bbe (apply: free patch->{def,old,new}_name fields, 2012-03-21) cleaned up the memory management of filenames in the patches, but forgot that find_name_traditional() can return NULL as a way of saying "I couldn't find a name". That NULL unfortunately gets passed into xstrdup() next, resulting in a segfault. Use null_strdup() so as to safely propagate the null, which will let us emit the correct error message. Reported-by: DevHC on #git Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-20Merge branch 'rs/logical-vs-binary-or'Libravatar Junio C Hamano3-6/+6
Code cleanup. * rs/logical-vs-binary-or: use logical OR (||) instead of binary OR (|) in logical context
2013-06-20Merge branch 'mm/color-auto-default'Libravatar Junio C Hamano1-0/+5
Flip the default for color.ui to 'auto', which is what many tutorials recommend new users to do. * mm/color-auto-default: make color.ui default to 'auto' config: refactor management of color.ui's default value
2013-06-20Extract a struct stat_data from cache_entryLibravatar Michael Haggerty1-5/+7
Add public functions fill_stat_data() and match_stat_data() to work with it. This infrastructure will later be used to check the validity of other types of file. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-20refs: implement simple transactions for the packed-refs fileLibravatar Michael Haggerty1-1/+4
Handle simple transactions for the packed-refs file at the packed_ref_cache level via new functions lock_packed_refs(), commit_packed_refs(), and rollback_packed_refs(). Only allow the packed ref cache to be modified (via add_packed_ref()) while the packed refs file is locked. Change clone to add the new references within a transaction. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-18name-rev: allow to specify a subpath for --refs optionLibravatar Namhyung Kim1-7/+29
When an user wants to filter specific ref using the --refs option, the pattern needs to match the full ref, e.g. --refs=refs/tags/v1.*. It'd be convenient to specify a subpath of ref pattern. For example, --refs=origin/* can find refs/remotes/origin/master by searching the pattern against its substrings in turn: refs/remotes/origin/master remotes/origin/master origin/master If it finds a match in a subpath, unambigous part of the ref path will be removed in the output. Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-18fix "builtin-*" references to be "builtin/*"Libravatar Phil Hord3-4/+2
Documentation and some comments still refer to files in builtin/ as 'builtin-*.[cho]'. Update these to show the correct location. Signed-off-by: Phil Hord <hordp@cisco.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Assisted-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-18builtin/checkout.c: don't leak memory in check_tracking_nameLibravatar Brandon Casey1-2/+5
remote_find_tracking() populates the query struct with an allocated string in the dst member. So, we do not need to xstrdup() the string, since we can transfer ownership from the query struct (which will go out of scope at the end of this function) to our callback struct, but we must free the string if it will not be used so we will not leak memory. Let's do so. Signed-off-by: Brandon Casey <drafnel@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-17rev-parse: add --prefix optionLibravatar John Keeping1-5/+19
This makes 'git rev-parse' behave as if it were invoked from the specified subdirectory of a repository, with the difference that any file paths which it prints are prefixed with the full path from the top of the working tree. This is useful for shell scripts where we may want to cd to the top of the working tree but need to handle relative paths given by the user on the command line. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-15status: introduce status.branch to enable --branch by defaultLibravatar Jorge Juan Garcia Garcia1-0/+4
Some people often run 'git status -b'. The config variable status.branch allows to set it by default. Signed-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr> Signed-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr> Reviewed-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-14Merge branch 'mh/reflife'Libravatar Junio C Hamano5-51/+57
Define memory ownership and lifetime rules for what for-each-ref feeds to its callbacks (in short, "you do not own it, so make a copy if you want to keep it"). * mh/reflife: (25 commits) refs: document the lifetime of the args passed to each_ref_fn register_ref(): make a copy of the bad reference SHA-1 exclude_existing(): set existing_refs.strdup_strings string_list_add_refs_by_glob(): add a comment about memory management string_list_add_one_ref(): rename first parameter to "refname" show_head_ref(): rename first parameter to "refname" show_head_ref(): do not shadow name of argument add_existing(): do not retain a reference to sha1 do_fetch(): clean up existing_refs before exiting do_fetch(): reduce scope of peer_item object_array_entry: fix memory handling of the name field find_first_merges(): remove unnecessary code find_first_merges(): initialize merges variable using initializer fsck: don't put a void*-shaped peg in a char*-shaped hole object_array_remove_duplicates(): rewrite to reduce copying revision: use object_array_filter() in implementation of gc_boundary() object_array: add function object_array_filter() revision: split some overly-long lines cmd_diff(): make it obvious which cases are exclusive of each other cmd_diff(): rename local variable "list" -> "entry" ...
2013-06-13use logical OR (||) instead of binary OR (|) in logical contextLibravatar René Scharfe3-6/+6
The compiler can short-circuit the evaluation of conditions strung together with logical OR operators instead of computing the resulting bitmask with binary ORs. More importantly, this patch makes the intent of the changed code clearer, because the logical context (as opposed to binary context) becomes immediately obvious. While we're at it, simplify the check for patch->is_rename in builtin/apply.c a bit; it can only be 0 or 1, so we don't need a comparison operator. Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-12rm: introduce advice.rmHints to shorten messagesLibravatar Mathieu Lienard--Mayor1-1/+2
Introduce advice.rmHints to choose whether to display advice or not when git rm fails. Defaults to true, in order to preserve current behavior. As an example, the message: error: 'foo.txt' has changes staged in the index (use --cached to keep the file, or -f to force removal) would look like, with advice.rmHints=false: error: 'foo.txt' has changes staged in the index Signed-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr> Signed-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-12rm: better error message on failure for multiple filesLibravatar Mathieu Lienard--Mayor1-19/+81
When 'git rm' fails, it now displays a single message with the list of files involved, instead of displaying a list of messages with one file each. As an example, the old message: error: 'foo.txt' has changes staged in the index (use --cached to keep the file, or -f to force removal) error: 'bar.txt' has changes staged in the index (use --cached to keep the file, or -f to force removal) would now be displayed as: error: the following files have changes staged in the index: foo.txt bar.txt (use --cached to keep the file, or -f to force removal) Signed-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr> Signed-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-12Move copy_note_for_rewrite + friends from builtin/notes.c to notes-utils.cLibravatar Johan Herland2-130/+2
This is a pure code movement of the machinery for copying notes to rewritten objects. This code was located in builtin/notes.c for historical reasons. In order to make it available to builtin/commit.c it was declared in builtin.h. This was more of an accident of history than a concious design, and we now want to make this machinery more widely available. Hence, this patch moves the code into the new notes-utils.[hc] files which are included into libgit.a. Except for adjusting #includes accordingly, this patch merely moves the relevant functions verbatim into the new files. Cc: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-12finish_copy_notes_for_rewrite(): Let caller provide commit messageLibravatar Johan Herland2-5/+6
When copying notes for a rewritten object, the resulting notes commit would have the following hardcoded commit message: Notes added by 'git notes copy' This is obviously bogus when the notes rewriting is performed by 'git commit --amend'. Therefore, let the caller specify an appropriate notes commit message instead of hardcoding it. The above message is used for 'git notes copy', but when calling finish_copy_notes_for_rewrite() from builtin/commit.c, we use the following message instead: Notes added by 'git commit --amend' Cc: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11toposort: rename "lifo" fieldLibravatar Junio C Hamano2-7/+9
The primary invariant of sort_in_topological_order() is that a parent commit is not emitted until all children of it are. When traversing a forked history like this with "git log C E": A----B----C \ D----E we ensure that A is emitted after all of B, C, D, and E are done, B has to wait until C is done, and D has to wait until E is done. In some applications, however, we would further want to control how these child commits B, C, D and E on two parallel ancestry chains are shown. Most of the time, we would want to see C and B emitted together, and then E and D, and finally A (i.e. the --topo-order output). The "lifo" parameter of the sort_in_topological_order() function is used to control this behaviour. We start the traversal by knowing two commits, C and E. While keeping in mind that we also need to inspect E later, we pick C first to inspect, and we notice and record that B needs to be inspected. By structuring the "work to be done" set as a LIFO stack, we ensure that B is inspected next, before other in-flight commits we had known that we will need to inspect, e.g. E. When showing in --date-order, we would want to see commits ordered by timestamps, i.e. show C, E, B and D in this order before showing A, possibly mixing commits from two parallel histories together. When "lifo" parameter is set to false, the function keeps the "work to be done" set sorted in the date order to realize this semantics. After inspecting C, we add B to the "work to be done" set, but the next commit we inspect from the set is E which is newer than B. The name "lifo", however, is too strongly tied to the way how the function implements its behaviour, and does not describe what the behaviour _means_. Replace this field with an enum rev_sort_order, with two possible values: REV_SORT_IN_GRAPH_ORDER and REV_SORT_BY_COMMIT_DATE, and update the existing code. The mechanical replacement rule is: "lifo == 0" is equivalent to "sort_order == REV_SORT_BY_COMMIT_DATE" "lifo == 1" is equivalent to "sort_order == REV_SORT_IN_GRAPH_ORDER" Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11status: introduce status.short to enable --short by defaultLibravatar Jorge Juan Garcia Garcia1-0/+7
Some people always run 'git status -s'. The configuration variable status.short allows to set it by default. Signed-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr> Signed-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr> Reviewed-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11Merge branch 'rs/unpack-trees-plug-leak'Libravatar Junio C Hamano1-2/+3
* rs/unpack-trees-plug-leak: unpack-trees: free cache_entry array members for merges diff-lib, read-tree, unpack-trees: mark cache_entry array paramters const diff-lib, read-tree, unpack-trees: mark cache_entry pointers const unpack-trees: create working copy of merge entry in merged_entry unpack-trees: factor out dup_entry read-cache: mark cache_entry pointers const cache: mark cache_entry pointers const
2013-06-10make color.ui default to 'auto'Libravatar Matthieu Moy1-1/+1
Most users seem to like having colors enabled, and colors can help beginners to understand the output of some commands (e.g. notice immediately the boundary between commits in the output of "git log"). Many tutorials tell the users to set color.ui=auto as a very first step, which tend to indicate that color.ui=none is not the recommanded value, hence should not be the default. These tutorials would benefit from skipping this step and starting the real Git manipulations earlier. Other beginners do not know about color.ui=auto, and may not discover it by themselves, hence live with black&white outputs while they may have preferred colors. A few people (e.g. color-blind) prefer having no colors, but they can easily set color.ui=never for this (and googling "disable colors in git" already tells them how to do so), but this needs not occupy space in beginner-oriented documentations. A transition period with Git emitting a warning when color.ui is unset would be possible, but the discomfort of having the warning seems superior to the benefit: users may be surprised by the change, but not harmed by it. The default value is changed, and the documentation is reworded to mention "color.ui=false" first, since the primary use of color.ui after this change is to disable colors, not to enable it. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-09Merge branch 'jn/config-ignore-inaccessible' into maintLibravatar Junio C Hamano1-2/+2
A git daemon that starts as "root" and then drops privilege often leaves $HOME set to that of the root user, which is unreadable by the daemon process, which was diagnosed as a configuration error. Make per-user configuration files that are inaccessible due to EACCES as though these files do not exist to avoid this issue, as the tightening which was originally meant as an additional security has annoyed enough sysadmins. * jn/config-ignore-inaccessible: config: allow inaccessible configuration under $HOME
2013-06-06Merge branch 'rr/push-head'Libravatar Junio C Hamano1-7/+14
"git push $there HEAD:branch" did not resolve HEAD early enough, so it was easy to flip it around while push is still going on and push out a branch that the user did not originally intended when the command was started. * rr/push-head: push: make push.default = current use resolved HEAD push: fail early with detached HEAD and current push: factor out the detached HEAD error message
2013-06-06Merge branch 'nd/clone-connectivity-shortcut'Libravatar Junio C Hamano2-14/+39
Special case "git clone" and use lighter-weight implementation to check the completeness of the history behind refs. * nd/clone-connectivity-shortcut: clone: open a shortcut for connectivity check index-pack: remove dead code (it should never happen) fetch-pack: prepare updated shallow file before fetching the pack clone: let the user know when check_everything_connected is run
2013-06-06Merge branch 'nd/prune-packed-dryrun-verbose'Libravatar Junio C Hamano2-9/+8
* nd/prune-packed-dryrun-verbose: prune-packed: avoid implying "1" is DRY_RUN in prune_packed_objects()
2013-06-05Merge branch 'rs/commit-m-no-edit'Libravatar Junio C Hamano1-4/+6
"git commit --allow-empty-message -m ''" should not start an editor. * rs/commit-m-no-edit: commit: don't start editor if empty message is given with -m
2013-06-02Merge branch 'tr/line-log'Libravatar Junio C Hamano2-91/+39
* tr/line-log: git-log(1): remove --full-line-diff description line-log: fix documentation formatting log -L: improve comments in process_all_files() log -L: store the path instead of a diff_filespec log -L: test merge of parallel modify/rename t4211: pass -M to 'git log -M -L...' test log -L: fix overlapping input ranges log -L: check range set invariants when we look it up Speed up log -L... -M log -L: :pattern:file syntax to find by funcname Implement line-history search (git log -L) Export rewrite_parents() for 'log -L' Refactor parse_loc
2013-06-02Merge branch 'mc/describe-first-parent'Libravatar Junio C Hamano1-0/+5
* mc/describe-first-parent: describe: Add --first-parent option
2013-06-02Merge branch 'jk/fetch-always-update-tracking'Libravatar Junio C Hamano1-22/+51
"git fetch origin master" unlike "git fetch origin" or "git fetch" did not update "refs/remotes/origin/master"; this was an early design decision to keep the update of remote tracking branches predictable, but in practice it turns out that people find it more convenient to opportunisticly update them whenever we have a chance, and we have been updating them when we run "git push" which already breaks the original "predictability" anyway. Now such a fetch does update refs/remotes/origin/master. * jk/fetch-always-update-tracking: fetch: don't try to update unfetched tracking refs fetch: opportunistically update tracking refs refactor "ref->merge" flag fetch/pull doc: untangle meaning of bare <ref> t5510: start tracking-ref tests from a known state
2013-06-02Merge branch 'vv/help-unknown-ref'Libravatar Junio C Hamano1-1/+2
Detect "git merge foo" that might have meant "git merge origin/foo" and give an error message that is more specific than "foo is not something we can merge". * vv/help-unknown-ref: merge: use help_unknown_ref() help: add help_unknown_ref()
2013-06-02Merge branch 'nd/clone-local-with-colon'Libravatar Junio C Hamano1-0/+2
"git clone foo/bar:baz" cannot be a request to clone from a remote over git-over-ssh specified in the scp style. Detect this case and clone from a local repository at "foo/bar:baz". * nd/clone-local-with-colon: clone: allow cloning local paths with colons in them
2013-06-02Merge branch 'fc/fast-export-persistent-marks'Libravatar Junio C Hamano1-7/+15
Optimization for fast-export by avoiding unnecessarily resolving arbitrary object name and parsing object when only presence and type information is necessary, etc. * fc/fast-export-persistent-marks: fast-{import,export}: use get_sha1_hex() to read from marks file fast-export: don't parse commits while reading marks file fast-export: do not parse non-commit objects while reading marks file
2013-06-02diff-lib, read-tree, unpack-trees: mark cache_entry array paramters constLibravatar René Scharfe1-1/+2
Change the type merge_fn_t to accept the array of cache_entry pointers as const pointers to const pointers. This documents the fact that the merge functions don't modify the cache_entry contents or replace any of the pointers in the array. Only a single cast is necessary in unpack_nondirectories because adding two const modifiers at once is not allowed in C. The cast is safe in that it doesn't mask any modfication; call_unpack_fn only needs the array for reading. Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-02diff-lib, read-tree, unpack-trees: mark cache_entry pointers constLibravatar René Scharfe1-1/+1
Add const to struct cache_entry pointers throughout the tree which are only used for reading. This allows callers to pass in const pointers. Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-02exclude_existing(): set existing_refs.strdup_stringsLibravatar Michael Haggerty1-1/+1
The each_ref_fn add_existing() adds refnames to the existing_refs list. But the lifetimes of these refnames is not guaranteed by the refs API, so configure the string_list to make copies as it adds them. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-02add_existing(): do not retain a reference to sha1Libravatar Michael Haggerty1-3/+4
Its lifetime is not guaranteed, so make a copy. Free the memory when the string_list is cleared. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-02do_fetch(): clean up existing_refs before exitingLibravatar Michael Haggerty1-5/+9
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-02do_fetch(): reduce scope of peer_itemLibravatar Michael Haggerty1-3/+3
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-29push: make push.default = current use resolved HEADLibravatar Ramkumar Ramachandra1-1/+1
With this change, the output of the push (with push.default set to current) changes subtly from: $ git push ... * [new branch] HEAD -> push-current-head to: $ git push ... * [new branch] push-current-head -> push-current-head This patch was written with a different motivation. There is a problem unique to push.default = current: # on branch push-current-head $ git push # on another terminal $ git checkout master # return to the first terminal # the push tried to push master! This happens because the 'git checkout' on the second terminal races with the 'git push' on the first terminal. Although this patch does not solve the core problem (there is still no guarantee that 'git push' on the first terminal will resolve HEAD before 'git checkout' changes HEAD on the second), it works in practice. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-29push: fail early with detached HEAD and currentLibravatar Ramkumar Ramachandra1-0/+5
Setting push.default to current adds the refspec "HEAD" for the transport layer to handle. If "HEAD" doesn't resolve to a branch (and since no refspec rhs is specified), the push fails after some time with a cryptic error message: $ git push error: unable to push to unqualified destination: HEAD The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref. error: failed to push some refs to 'git@github.com:artagnon/git' Fail early with a nicer error message: $ git push fatal: You are not currently on a branch. To push the history leading to the current (detached HEAD) state now, use git push ram HEAD:<name-of-remote-branch> Just like in the upstream and simple cases. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>