summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-07-13t1512: match the "other" object namesLibravatar Junio C Hamano1-3/+3
The test creates 16 objects that share the same prefix, and two other objects that do not. Tweak the test so that the other two share the same prefix that is different from the one that is shared by the 16. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-11t1512: ignore whitespaces in wc -l outputLibravatar Junio C Hamano1-1/+1
Some implementations of sed (e.g. MacOS X) have whitespaces in the output of "wc -l" that reads from the standard input. Ignore these whitespaces by not quoting the command substitution to be compared with the constant "16". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09rev-parse --disambiguate=<prefix>Libravatar Junio C Hamano5-9/+78
The new option allows you to feed an ambiguous prefix and enumerate all the objects that share it as a prefix of their object names. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09rev-parse: A and B in "rev-parse A..B" refer to committishLibravatar Junio C Hamano2-3/+3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09reset: the command takes committishLibravatar Junio C Hamano2-3/+9
This is not strictly correct, in that resetting selected index entries from corresponding paths out of a given tree without moving HEAD is a valid operation, and in such case a tree-ish would suffice. But the existing code already requires a committish in the codepath, so let's be consistent with it for now. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09commit-tree: the command wants a tree and commitsLibravatar Junio C Hamano2-6/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09apply: --build-fake-ancestor expects blobsLibravatar Junio C Hamano2-2/+2
The "index" line read from the patch to reconstruct a partial preimage tree records the object names of blob objects. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09sha1_name.c: add support for disambiguating other typesLibravatar Junio C Hamano3-5/+76
This teaches the revision parser that in "$name:$path" (used for a blob object name), "$name" must be a tree-ish. There are many more places where we know what types of objects are called for. This patch adds support for "commit", "treeish", "tree", and "blob", which could be used in the following contexts: - "git apply --build-fake-ancestor" reads the "index" lines from the patch; they must name blob objects (not even "blob-ish"); - "git commit-tree" reads a tree object name (not "tree-ish"), and zero or more commit object names (not "committish"); - "git reset $rev" wants a committish; "git reset $rev -- $path" wants a treeish. They will come in later patches in the series. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09revision.c: the "log" family, except for "show", takes committishLibravatar Junio C Hamano4-3/+15
Add a field to setup_revision_opt structure and allow these callers to tell the setup_revisions command parsing machinery that short SHA1 it encounters are meant to name committish. This step does not go all the way to connect the setup_revisions() to sha1_name.c yet. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09revision.c: allow handle_revision_arg() to take other flagsLibravatar Junio C Hamano3-8/+10
The existing "cant_be_filename" that tells the function that the caller knows the arg is not a path (hence it does not have to be checked for absense of the file whose name matches it) is made into a bit in the flag word. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09sha1_name.c: introduce get_sha1_committish()Libravatar Junio C Hamano5-7/+25
Many callers know that the user meant to name a committish by syntactical positions where the object name appears. Calling this function allows the machinery to disambiguate shorter-than-unique abbreviated object names between committish and others. Note that this does NOT error out when the named object is not a committish. It is merely to give a hint to the disambiguation machinery. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09sha1_name.c: teach lookup context to get_sha1_with_context()Libravatar Junio C Hamano4-13/+18
The function takes user input string and returns the object name (binary SHA-1) with mode bits and path when the object was looked up in a tree. Additionally give hints to help disambiguation of abbreviated object names when the caller knows what it is looking for. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09sha1_name.c: many short names can only be committishLibravatar Junio C Hamano3-5/+30
We know that the token "$name" that appear in "$name^{commit}", "$name^4", "$name~4" etc. can only name a committish (either a commit or a tag that peels to a commit). Teach get_short_sha1() to take advantage of that knowledge when disambiguating an abbreviated SHA-1 given as an object name. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09sha1_name.c: get_sha1_1() takes lookup flagsLibravatar Junio C Hamano1-8/+8
This is to pass the disambiguation hints from the caller down the callchain. Nothing is changed in this step, as everybody just passes 0 in the flag. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-09sha1_name.c: get_describe_name() by definition groks only commitsLibravatar Junio C Hamano2-1/+257
Teach get_describe_name() to pass the disambiguation hint down the callchain to get_short_sha1(). Also add tests to show various syntactic elements that we could take advantage of the object type information to help disambiguration of abbreviated object names. Many of them are marked as broken, and some of them will be fixed in later patches in this series. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03sha1_name.c: teach get_short_sha1() a commit-only optionLibravatar Junio C Hamano2-0/+10
When the caller knows that the parameter is meant to name a commit, e.g. "56789a" in describe name "v1.2.3-4-g56789a", pass that as a hint so that lower level can use it to disambiguate objects when there is only one commit whose name begins with 56789a even if there are objects of other types whose names share the same prefix. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03sha1_name.c: allow get_short_sha1() to take other flagsLibravatar Junio C Hamano2-3/+6
Instead of a separate "int quietly" argument, make it take "unsigned flags" so that we can pass other options to it. The bit assignment of this flag word is exposed in cache.h because the mechanism will be exposed to callers of the higher layer in later commits in this series. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03get_sha1(): fix error status regressionLibravatar Junio C Hamano1-1/+1
In finish_object_disambiguation(), if the candidate hasn't been checked, there are two cases: - It is the first and only object that match the prefix; or - It replaced another object that matched the prefix but that object did not satisfy ds->fn() callback. And the former case we set ds->candidate_ok to true without doing anything else, while for the latter we check the candidate, which may set ds->candidate_ok to false. At this point in the code, ds->candidate_ok can be false only if this last-round check found that the candidate does not pass the check, because the state after update_candidates() returns cannot satisfy !ds->ambiguous && ds->candidate_exists && ds->candidate_checked and !ds->canidate_ok at the same time. Hence, when we execute this "return", we know we have seen more than one object that match the prefix (and none of them satisfied ds->fn), meaning that we should say "the short name is ambiguous", not "there is no object that matches the prefix". Noticed by Jeff King. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03sha1_name.c: restructure disambiguation of short namesLibravatar Junio C Hamano1-60/+112
We try to find zero, one or more matches from loose objects and packed objects independently and then decide if the given short object name is unique across them. Instead, introduce a "struct disambiguate_state" that keeps track of what we have found so far, that can be one of: - We have seen one object that _could_ be what we are looking for; - We have also checked that object for additional constraints (if any), and found that the object satisfies it; - We have also checked that object for additional constraints (if any), and found that the object does not satisfy it; or - We have seen more than one objects that satisfy the constraints. and pass it to the enumeration functions for loose and packed objects. The disambiguation state can optionally take a callback function that takes a candidate object name and reports if the object satisifies additional criteria (e.g. when the caller knows that the short name must refer to a commit, this mechanism can be used to check the type of the given object). Compared to the earlier attempt, this round avoids the optional check if there is only one candidate that matches the short name in the first place. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03sha1_name.c: correct misnamed "canonical" and "res"Libravatar Junio C Hamano1-22/+22
These are hexadecimal and binary representation of the short object name given to the callchain as its input. Rename them with _pfx suffix to make it clear they are prefixes, and call them hex and bin respectively. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03sha1_name.c: refactor find_short_packed_object()Libravatar Junio C Hamano1-47/+56
Extract the logic to find object(s) that match a given prefix inside a single pack into a separate helper function, and give it a bit more comment. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03sha1_name.c: rename "now" to "current"Libravatar Junio C Hamano1-8/+8
This variable points at the element we are currently looking at, and does not have anything to do with the current time which the name "now" implies. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03sha1_name.c: clarify what "fake" is for in find_short_object_filename()Libravatar Junio C Hamano1-0/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03sha1_name.c: get rid of get_sha1_with_mode()Libravatar Junio C Hamano3-15/+6
There are only two callers, and they will benefit from being able to pass disambiguation hints to underlying get_sha1_with_context() API once it happens. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-03sha1_name.c: get rid of get_sha1_with_mode_1()Libravatar Junio C Hamano3-15/+20
The only external caller is setup.c that tries to give a nicer error message when an object name is misspelt (e.g. "HEAD:cashe.h"). Retire it and give the caller a dedicated and more intuitive API function maybe_die_on_misspelt_object_name(). Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-02sha1_name.c: hide get_sha1_with_context_1() uglinessLibravatar Junio C Hamano2-18/+19
There is no outside caller that cares about the "only-to-die" ugliness. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-06-18sha1_name.c: indentation fixLibravatar Junio C Hamano1-2/+2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-27Git 1.7.9Libravatar Junio C Hamano2-1/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-26INSTALL: warn about recent Fedora breakageLibravatar Junio C Hamano1-1/+5
Recent releases of Redhat/Fedora are reported to ship Perl binary package with some core modules stripped away (see http://lwn.net/Articles/477234/) against the upstream Perl5 people's wishes. The Time::HiRes module used by gitweb one of them. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-26git-completion: workaround zsh COMPREPLY bugLibravatar Felipe Contreras1-0/+8
zsh adds a backslash (foo\ ) for each item in the COMPREPLY array if IFS doesn't contain spaces. This issue has been reported[1], but there is no solution yet. This wasn't a problem due to another bug[2], which was fixed in zsh version 4.3.12. After this change, 'git checkout ma<tab>' would resolve to 'git checkout master\ '. Aditionally, the introduction of __gitcomp_nl in commit a31e626 (completion: optimize refs completion) in git also made the problem apparent, as Matthieu Moy reported. The simplest and most generic solution is to hide all the changes we do to IFS, so that "foo \nbar " is recognized by zsh as "foo bar". This works on versions of git before and after the introduction of __gitcomp_nl (a31e626), and versions of zsh before and after 4.3.12. Once zsh is fixed, we should conditionally disable this workaround to have the same benefits as bash users. [1] http://www.zsh.org/mla/workers/2012/msg00053.html [2] http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=commitdiff;h=2e25dfb8fd38dbef0a306282ffab1d343ce3ad8d Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-26docs: minor grammar fixes for v1.7.9 release notesLibravatar Jeff King1-6/+7
Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-23Fix typo in 1.7.9 release notesLibravatar Michael Haggerty1-1/+1
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-18Git 1.7.9-rc2Libravatar Junio C Hamano2-10/+2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-18Merge branch 'maint'Libravatar Junio C Hamano3-2/+12
* maint: Git 1.7.8.4 Git 1.7.7.6 diff-index: enable recursive pathspec matching in unpack_trees Conflicts: GIT-VERSION-GEN
2012-01-18Git 1.7.8.4Libravatar Junio C Hamano3-3/+9
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-18Merge branch 'maint-1.7.7' into maintLibravatar Junio C Hamano3-0/+14
* maint-1.7.7: Git 1.7.7.6 diff-index: enable recursive pathspec matching in unpack_trees Conflicts: GIT-VERSION-GEN
2012-01-18Git 1.7.7.6Libravatar Junio C Hamano2-1/+5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-18diff-index: enable recursive pathspec matching in unpack_treesLibravatar Nguyen Thai Ngoc Duy2-0/+10
The pathspec structure has a few bits of data to drive various operation modes after we unified the pathspec matching logic in various codepaths. For example, max_depth field is there so that "git grep" can limit the output for files found in limited depth of tree traversal. Also in order to show just the surface level differences in "git diff-tree", recursive field stops us from descending into deeper level of the tree structure when it is set to false, and this also affects pathspec matching when we have wildcards in the pathspec. The diff-index has always wanted the recursive behaviour, and wanted to match pathspecs without any depth limit. But we forgot to do so when we updated tree_entry_interesting() logic to unify the pathspec matching logic. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-18Merge branch 'jc/pull-signed-tag-doc'Libravatar Junio C Hamano2-1/+221
* jc/pull-signed-tag-doc: pulling signed tag: add howto document
2012-01-18pulling signed tag: add howto documentLibravatar Junio C Hamano2-1/+221
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-18Merge branch 'jk/credentials'Libravatar Junio C Hamano2-22/+92
* jk/credentials: credential-cache: ignore "connection refused" errors unix-socket: do not let close() or chdir() clobber errno during cleanup credential-cache: report more daemon connection errors unix-socket: handle long socket pathnames
2012-01-18Merge branch 'nd/pathspec-recursion-cleanup'Libravatar Junio C Hamano4-0/+16
* nd/pathspec-recursion-cleanup: diff-index: enable recursive pathspec matching in unpack_trees Document limited recursion pathspec matching with wildcards
2012-01-18Merge branch 'mh/maint-show-ref-doc'Libravatar Junio C Hamano1-3/+3
* mh/maint-show-ref-doc: git-show-ref doc: typeset regexp in fixed width font git-show-ref: fix escaping in asciidoc source
2012-01-18Merge branch 'tr/maint-word-diff-incomplete-line'Libravatar Junio C Hamano2-0/+23
* tr/maint-word-diff-incomplete-line: word-diff: ignore '\ No newline at eof' marker
2012-01-16credential-cache: ignore "connection refused" errorsLibravatar Jeff King1-1/+1
The credential-cache helper will try to connect to its daemon over a unix socket. Originally, a failure to do so was silently ignored, and we would either give up (if performing a "get" or "erase" operation), or spawn a new daemon (for a "store" operation). But since 8ec6c8d, we try to report more errors. We detect a missing daemon by checking for ENOENT on our connection attempt. If the daemon is missing, we continue as before (giving up or spawning a new daemon). For any other error, we die and report the problem. However, checking for ENOENT is not sufficient for a missing daemon. We might also get ECONNREFUSED if a dead daemon process left a stale socket. This generally shouldn't happen, as the daemon cleans up after itself, but the daemon may not always be given a chance to do so (e.g., power loss, "kill -9"). The resulting state is annoying not just because the helper outputs an extra useless message, but because it actually blocks the helper from spawning a new daemon to replace the stale socket. Fix it by checking for ECONNREFUSED. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-16Merge branch 'jn/maint-gitweb-grep-fix'Libravatar Junio C Hamano1-10/+10
* jn/maint-gitweb-grep-fix: gitweb: Harden "grep" search against filenames with ':' gitweb: Fix file links in "grep" search
2012-01-16diff-index: enable recursive pathspec matching in unpack_treesLibravatar Nguyen Thai Ngoc Duy2-0/+10
The pathspec structure has a few bits of data to drive various operation modes after we unified the pathspec matching logic in various codepaths. For example, max_depth field is there so that "git grep" can limit the output for files found in limited depth of tree traversal. Also in order to show just the surface level differences in "git diff-tree", recursive field stops us from descending into deeper level of the tree structure when it is set to false, and this also affects pathspec matching when we have wildcards in the pathspec. The diff-index has always wanted the recursive behaviour, and wanted to match pathspecs without any depth limit. But we forgot to do so when we updated tree_entry_interesting() logic to unify the pathspec matching logic. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-14Document limited recursion pathspec matching with wildcardsLibravatar Nguyễn Thái Ngọc Duy2-0/+6
It's actually unlimited recursion if wildcards are active regardless --max-depth Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-13git-show-ref doc: typeset regexp in fixed width fontLibravatar Michael Haggerty1-1/+1
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-13git-show-ref: fix escaping in asciidoc sourceLibravatar Michael Haggerty1-3/+3
Two "^" characters were incorrectly being interpreted as markup for superscripting. Fix them by writing them as attribute references "{caret}". Although a single "^" character in a paragraph cannot be misinterpreted in this way, also write other "^" characters as "{caret}" in the interest of good hygiene (unless they are in literal paragraphs, of course, in which context attribute references are not recognized). Spell "{}" consistently, namely *not* quoted as "\{\}". Since the braces are empty, they cannot be interpreted as an attribute reference, and either spelling is OK. So arbitrarily choose one variation and use it consistently. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>