aboutsummaryrefslogtreecommitdiff
path: root/builtin-show-ref.c
Commit message (Collapse)AuthorAge
* Make every builtin-*.c file #include "builtin.h"Peter Hagervall2007-07-14
| | | | | | | | | Make every builtin-*.c file #include "builtin.h". Also takes care of some declaration/definition mismatches. Signed-off-by: Peter Hagervall <hager@cs.umu.se> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint'Junio C Hamano2007-02-24
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | * maint: diff-patch: Avoid emitting double-slashes in textual patch. Reword git-am 3-way fallback failure message. Limit filename for format-patch core.legacyheaders: Use the description used in RelNotes-1.5.0 git-show-ref --verify: Fail if called without a reference Conflicts: builtin-show-ref.c diff.c
| * git-show-ref --verify: Fail if called without a referenceDmitry V. Levin2007-02-24
| | | | | | | | | | | | | | | | builtin-show-ref.c (cmd_show_ref): Fail if called with --verify option but without a reference. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Mechanical conversion to use prefixcmp()Junio C Hamano2007-02-20
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This mechanically converts strncmp() to use prefixcmp(), but only when the parameters match specific patterns, so that they can be verified easily. Leftover from this will be fixed in a separate step, including idiotic conversions like if (!strncmp("foo", arg, 3)) => if (!(-prefixcmp(arg, "foo"))) This was done by using this script in px.perl #!/usr/bin/perl -i.bak -p if (/strncmp\(([^,]+), "([^\\"]*)", (\d+)\)/ && (length($2) == $3)) { s|strncmp\(([^,]+), "([^\\"]*)", (\d+)\)|prefixcmp($1, "$2")|; } if (/strncmp\("([^\\"]*)", ([^,]+), (\d+)\)/ && (length($1) == $3)) { s|strncmp\("([^\\"]*)", ([^,]+), (\d+)\)|(-prefixcmp($2, "$1"))|; } and running: $ git grep -l strncmp -- '*.c' | xargs perl px.perl Signed-off-by: Junio C Hamano <junkio@cox.net>
* show-ref: fix --exclude-existingJunio C Hamano2006-12-18
| | | | | | | | | | Do not falsely document --filter-invalid which does not even exist. Also make sure the line is long enough to have ^{} suffix before checking for it. Pointed out by Dscho. Signed-off-by: Junio C Hamano <junkio@cox.net>
* show-ref: fix --verify --hash=lengthJunio C Hamano2006-12-17
| | | | | | | | | | | An earlier optimization for --verify broke a lot of stuff because it did not take interaction with other flags into account. This also fixes an unrelated argument parsing error; --hash=8 should mean the same as "--hash --abbrev=8". Signed-off-by: Junio C Hamano <junkio@cox.net>
* show-ref: fix --quiet --verifyJunio C Hamano2006-12-17
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* avoid accessing _all_ loose refs in git-show-ref --verifyJunio C Hamano2006-12-17
| | | | | | | | If you want to verify a ref, it is overkill to first read all loose refs into a linked list, and then check if the desired ref is there. Signed-off-by: Junio C Hamano <junkio@cox.net> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
* git-fetch: Avoid reading packed refs over and over againJunio C Hamano2006-12-17
| | | | | | | | | | | | When checking which tags to fetch, the old code used to call git-show-ref --verify for each remote tag. Since reading even packed refs is not a cheap operation when there are a lot of local refs, the code became quite slow. This fixes it by teaching git-show-ref to filter out existing refs using a new mode of operation of git-show-ref. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Store peeled refs in packed-refs (take 2).Junio C Hamano2006-11-21
| | | | | | | | | | | | | | | | | This fixes the previous implementation which failed to optimize repositories with tons of lightweight tags. The updated packed-refs format begins with "# packed-refs with:" line that lists the kind of extended data the file records. Currently, there is only one such extension defined, "peeled". This stores the "peeled tag" on a line that immediately follows a line for a tag object itself in the format "^<sha-1>". The header line itself and any extended data are ignored by older implementation, so packed-refs file generated with this version can still be used by older git. packed-refs made by older git can of course be used with this version. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Store peeled refs in packed-refs file.Junio C Hamano2006-11-19
| | | | | | | This would speed up "show-ref -d" in a repository with mostly packed tags. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fix show-ref usagestringLars Hjemli2006-10-26
| | | | | | | This describes the abbreviation possibilities for git-show-ref Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* show-ref --hash=len, --abbrev=len, and --abbrevJunio C Hamano2006-10-01
| | | | | | This teaches show-ref to abbreviate the object name. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'lt/refs' into jc/lt-ref2-with-lt-refsJunio C Hamano2006-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | * lt/refs: (58 commits) git-pack-refs --prune pack-refs: do not pack symbolic refs. Tell between packed, unpacked and symbolic refs. Add callback data to for_each_ref() family. symbolit-ref: fix resolve_ref conversion. Fix broken sha1 locking fsck-objects: adjust to resolve_ref() clean-up. gitignore: git-pack-refs is a generated file. wt-status: use simplified resolve_ref to find current branch Fix t1400-update-ref test minimally Enable the packed refs file format Make ref resolution saner Add support for negative refs Start handling references internally as a sorted in-memory list gitweb fix validating pg (page) parameter git-repack(1): document --window and --depth git-apply(1): document --unidiff-zero gitweb: fix warnings in PATH_INFO code and add export_ok/strict_export upload-archive: monitor child communication even more carefully. gitweb: export options ...
* Fix show-ref usage for --dereference.Christian Couder2006-09-20
| | | | | Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add [-s|--hash] option to Linus' show-ref.Christian Couder2006-09-17
| | | | | | | | With this option only the sha1 hash of the ref should be printed. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Add "git show-ref" builtin commandLinus Torvalds2006-09-16
It's kind of like "git peek-remote", but works only locally (and thus avoids the whole overhead of git_connect()) and has some extra verification features. For example, it allows you to filter the results, and to choose whether you want the tag dereferencing or not. You can also use it to just test whether a particular ref exists. For example: git show-ref master will show all references called "master", whether tags or heads or anything else, and regardless of how deep in the reference naming hierarchy they are (so it would show "refs/heads/master" but also "refs/remote/other-repo/master"). When using the "--verify" flag, the command requires an exact ref path: git show-ref --verify refs/heads/master will only match the exact branch called "master". If nothing matches, show-ref will return an error code of 1, and in the case of verification, it will show an error message. For scripting, you can ask it to be quiet with the "--quiet" flag, which allows you to do things like git-show-ref --quiet --verify -- "refs/heads/$headname" || echo "$headname is not a valid branch" to check whether a particular branch exists or not (notice how we don't actually want to show any results, and we want to use the full refname for it in order to not trigger the problem with ambiguous partial matches). To show only tags, or only proper branch heads, use "--tags" and/or "--heads" respectively (using both means that it shows tags _and_ heads, but not other random references under the refs/ subdirectory). To do automatic tag object dereferencing, use the "-d" or "--dereference" flag, so you can do git show-ref --tags --dereference to get a listing of all tags together with what they dereference. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>