summaryrefslogtreecommitdiff
path: root/sha1_name.c
Commit message (Collapse)AuthorAgeFilesLines
* i18n: mark @{upstream} error messages for translationZbigniew Jędrzejewski-Szmek2012-04-151-4/+4
| | | | | Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Be more specific if upstream branch is not trackedZbigniew Jędrzejewski-Szmek2012-04-151-1/+6
| | | | | | | | | | | | | | | | | | | | | If the branch configured as upstream didn't have a local tracking branch, git said "Upstream branch not found". We can be more helpful, and separate the cases when upstream is not configured, and when it is configured, but the upstream branch is not tracked in a local branch. The following configuration leads to the second scenario: [remote "origin"] url = ... fetch = refs/heads/master [branch "master"] remote = origin merge = refs/heads/master 'git pull' will work on master, but master@{upstream} is not defined. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Provide better message for barnhc_wiht_tpyo@{u}Zbigniew Jędrzejewski-Szmek2012-04-151-1/+4
| | | | | | | | | Instead of just saying that no upstream exists for such branch, which is true but not very helpful, check that there's no refs/heads/barnhc_wiht_tpyo and tell it to the user. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Provide branch name in error message when using @{u}Zbigniew Jędrzejewski-Szmek2012-04-151-4/+8
| | | | | | | | | | | | | | | | | | When using @{u} or @{upstream} it is common to omit the branch name, implying current branch. If the upstream is not configured, the error message was "No upstream branch found for ''". When resolving '@{u}', branch_get() is called, which almost always returns a description of a branch. This allows us to use a branch name in the error message, even if the user said something like '@{u}'. The only case when branch_get() returns NULL is when HEAD points to so something which is not a branch. Of course this also means that no upstream is configured, but it is better to directly say that HEAD does not point to a branch. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jc/broken-ref-dwim-fix'Junio C Hamano2011-10-211-85/+0
|\ | | | | | | | | | | | | * jc/broken-ref-dwim-fix: resolve_ref(): report breakage to the caller without warning resolve_ref(): expose REF_ISBROKEN flag refs.c: move dwim_ref()/dwim_log() from sha1_name.c
| * refs.c: move dwim_ref()/dwim_log() from sha1_name.cJunio C Hamano2011-10-121-85/+0
| | | | | | | | | | | | | | | | Both dwim_ref()/dwim_log() functions are intimately related to the ref parsing rules defined in refs.c and better fits there. Move them together with substitute_branch_name(), a file scope static helper function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'mh/check-ref-format-3'Junio C Hamano2011-10-101-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * mh/check-ref-format-3: (23 commits) add_ref(): verify that the refname is formatted correctly resolve_ref(): expand documentation resolve_ref(): also treat a too-long SHA1 as invalid resolve_ref(): emit warnings for improperly-formatted references resolve_ref(): verify that the input refname has the right format remote: avoid passing NULL to read_ref() remote: use xstrdup() instead of strdup() resolve_ref(): do not follow incorrectly-formatted symbolic refs resolve_ref(): extract a function get_packed_ref() resolve_ref(): turn buffer into a proper string as soon as possible resolve_ref(): only follow a symlink that contains a valid, normalized refname resolve_ref(): use prefixcmp() resolve_ref(): explicitly fail if a symlink is not readable Change check_refname_format() to reject unnormalized refnames Inline function refname_format_print() Make collapse_slashes() allocate memory for its result Do not allow ".lock" at the end of any refname component Refactor check_refname_format() Change check_ref_format() to take a flags argument Change bad_ref_char() to return a boolean value ...
| * Change check_ref_format() to take a flags argumentMichael Haggerty2011-10-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change check_ref_format() to take a flags argument that indicates what is acceptable in the reference name (analogous to "git check-ref-format"'s "--allow-onelevel" and "--refspec-pattern"). This is more convenient for callers and also fixes a failure in the test suite (and likely elsewhere in the code) by enabling "onelevel" and "refspec-pattern" to be allowed independently of each other. Also rename check_ref_format() to check_refname_format() to make it obvious that it deals with refnames rather than references themselves. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Allow git merge ":/<pattern>"jc/want-commitJunio C Hamano2011-09-151-6/+0
|/ | | | | | | | | | | | | It probably is not such a good idea to use ":/<pattern>" to specify which commit to merge, as ":/<pattern>" can often hit unexpected commits, but somebody tried it and got a nonsense error message: fatal: ':/Foo bar' does not point to a commit So here is a for-the-sake-of-consistency update that is fairly useless that allows users to carefully try not shooting in the foot. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jc/magic-pathspec'Junio C Hamano2011-05-231-8/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jc/magic-pathspec: setup.c: Fix some "symbol not declared" sparse warnings t3703: Skip tests using directory name ":" on Windows revision.c: leave a note for "a lone :" enhancement t3703, t4208: add test cases for magic pathspec rev/path disambiguation: further restrict "misspelled index entry" diag fix overslow :/no-such-string-ever-existed diagnostics fix overstrict :<path> diagnosis grep: use get_pathspec() correctly pathspec: drop "lone : means no pathspec" from get_pathspec() Revert "magic pathspec: add ":(icase)path" to match case insensitively" magic pathspec: add ":(icase)path" to match case insensitively magic pathspec: futureproof shorthand form magic pathspec: add tentative ":/path/from/top/level" pathspec support
| * fix overslow :/no-such-string-ever-existed diagnosticsJunio C Hamano2011-05-101-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "git cmd :/no-such-string-ever-existed" runs an extra round of get_sha1() since 009fee4 (Detailed diagnosis when parsing an object name fails., 2009-12-07). Once without error diagnosis to see there is no commit with such a string in the log message (hence "it cannot be a ref"), and after seeing that :/no-such-string-ever-existed is not a filename (hence "it cannot be a path, either"), another time to give "better diagnosis". The thing is, the second time it runs, we already know that traversing the history all the way down to the root will _not_ find any matching commit. Rename misguided "gently" parameter, which is turned off _only_ when the "detailed diagnosis" codepath knows that it cannot be a ref and making the call only for the caller to die with a message. Flip its meaning (and adjust the callers) and call it "only_to_die", which is not a great name, but it describes far more clearly what the codepaths that switches their behaviour based on this variable do. On my box, the command spends ~1.8 seconds without the patch to make the report; with the patch it spends ~1.12 seconds. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * fix overstrict :<path> diagnosisJunio C Hamano2011-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given "git log :", we get a disambiguation message that tries to be helpful and yet totally misses the point, i.e. $ git log : fatal: Path '' does not exist (neither on disk nor in the index). $ git log :/ fatal: Path '/' exists on disk, but not in the index. An empty path nor anything that begins with '/' cannot possibly in the index, and it is wrong to guess that the user might have meant to access such an index entry. It should yield the same error message as "git log '*.c'", i.e. $ git log '*.c' fatal: ambiguous argument '*.c': unknown revision or path not in the working tree. Use '--' to separate paths from revisions Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | sha1_name: Suggest commit:./file for path in subdirMichael J Gruber2011-04-031-4/+7
|/ | | | | | | | Currently, the "Did you mean..." message suggests "commit:fullpath" only. Extend this to show the more convenient "commit:./file" form also. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Revert "core.abbrevguard: Ensure short object names stay unique a bit longer"Junio C Hamano2011-03-101-3/+1
| | | | | | | | | This reverts commit 72a5b561fc1c4286bc7c5b0693afc076af261e1f, as adding fixed number of hexdigits more than necessary to make one object name locally unique does not help in futureproofing the uniqueness of names we generate today. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'tf/commit-list-prefix'Junio C Hamano2010-12-221-1/+1
|\ | | | | | | | | | | | | | | * tf/commit-list-prefix: commit: Add commit_list prefix in two function names. Conflicts: sha1_name.c
| * commit: Add commit_list prefix in two function names.Thiago Farina2010-11-291-1/+1
| | | | | | | | | | | | | | | | Add commit_list prefix to insert_by_date function and to sort_by_date, so it's clear that these functions refer to commit_list structure. Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'nd/oneline-sha1-name-from-specific-ref'Junio C Hamano2010-12-211-28/+55
|\ \ | | | | | | | | | | | | | | | | | | | | | * nd/oneline-sha1-name-from-specific-ref: get_sha1: handle special case $commit^{/} get_sha1: support $commit^{/regex} syntax get_sha1_oneline: make callers prepare the commit list to traverse get_sha1_oneline: fix lifespan rule of temp_commit_buffer variable
| * | get_sha1: handle special case $commit^{/}Nguyễn Thái Ngọc Duy2010-12-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Empty regex pattern should always match. But the exact behavior of regexec() may vary. Because it always matches anyway, we can just return 'matched' without calling regex machinery. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | get_sha1: support $commit^{/regex} syntaxNguyễn Thái Ngọc Duy2010-12-141-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | This works like ":/regex" syntax that finds a recently created commit starting from all refs, but limits the discovery to those reachable from the named commit. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | get_sha1_oneline: make callers prepare the commit list to traverseNguyễn Thái Ngọc Duy2010-12-121-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | This gives callers more control, i.e. which ref will be searched from. They must prepare the list ordered by committer date. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | get_sha1_oneline: fix lifespan rule of temp_commit_buffer variableJunio C Hamano2010-12-121-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is trying to free only what we ourselves read (as opposed to what we borrowed from commit->buffer) but do so lazily only to work around the fact that the code has many irregular exit points, and doing it right makes it necessary to call free() from many different places in the loop. Rewrite the structure of the code inside the loop so that the variable has to live within a single iteration, ever. This should make the logic easier to follow as well. Also we didn't free a temporary commit list we kept to hold the original set of commits. Free it. Noticed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'nd/extended-sha1-relpath'Junio C Hamano2010-12-161-2/+35
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | * nd/extended-sha1-relpath: get_sha1: teach ":$n:<path>" the same relative path logic get_sha1: support relative path ":path" syntax Make prefix_path() return char* without const Conflicts: sha1_name.c
| * | get_sha1: teach ":$n:<path>" the same relative path logicJunio C Hamano2010-12-091-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We taught the object name parser to take ":./<path>", ":../<path>", etc. and understand them to be relative to the current working directory. Given that ":<path>" is just a short-hand for ":0:<path>" (i.e. "take stage #0 of that path"), we should allow ":$n:<path>" to interpret them the same way. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | get_sha1: support relative path ":path" syntaxNguyễn Thái Ngọc Duy2010-12-071-3/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently :path and ref:path can be used to refer to a specific object in index or ref respectively. "path" component is absolute path. This patch allows "path" to be written as "./path" or "../path", which is relative to user's original cwd. This does not work in commands for which startup_info is NULL (i.e. non-builtin ones, it seems none of them needs this anyway). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jn/thinner-wrapper'Junio C Hamano2010-12-031-0/+18
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jn/thinner-wrapper: Remove pack file handling dependency from wrapper.o pack-objects: mark file-local variable static wrapper: give zlib wrappers their own translation unit strbuf: move strbuf_branchname to sha1_name.c path helpers: move git_mkstemp* to wrapper.c wrapper: move odb_* to environment.c wrapper: move xmmap() to sha1_file.c
| * | | strbuf: move strbuf_branchname to sha1_name.cJonathan Nieder2010-11-101-0/+18
| |/ / | | | | | | | | | | | | | | | | | | | | | strbuf_branchname is a thin wrapper around interpret_branch_name from sha1_name.o. Most strbuf.o users do not need it. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/abbrev-guard'Junio C Hamano2010-12-031-1/+3
|\ \ \ | |_|/ |/| | | | | | | | * jc/abbrev-guard: core.abbrevguard: Ensure short object names stay unique a bit longer
| * | core.abbrevguard: Ensure short object names stay unique a bit longerJunio C Hamano2010-10-281-1/+3
| |/ | | | | | | | | | | | | | | | | | | | | Even though git makes sure that it uses enough hexdigits to show an abbreviated object name unambiguously, as more objects are added to the repository over time, a short name that used to be unique will stop being unique. Git uses this many extra hexdigits that are more than necessary to make the object name currently unique, in the hope that its output will stay unique a bit longer. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ks/no-textconv-symlink'Junio C Hamano2010-11-171-0/+2
|\ \ | |/ |/| | | | | | | | | * ks/no-textconv-symlink: blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664'' blame,cat-file: Demonstrate --textconv is wrongly running converter on symlinks blame,cat-file: Prepare --textconv tests for correctly-failing conversion program
| * blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664''Kirill Smelkov2010-09-291-0/+2
| | | | | | | | | | | | | | | | | | | | We need to get the correct mode when blame reads the source from the working tree, the index, or trees. This allows us to omit running textconv filters on symbolic links. Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Reviewed-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Merge branch 'jc/sha1-name-find-fix' into maintJunio C Hamano2010-08-191-10/+11
| |\ | | | | | | | | | | | | | | | | | | | | | * jc/sha1-name-find-fix: sha1_name.c: fix parsing of ":/token" syntax Conflicts: sha1_name.c
* | | update comment and documentation for :/foo syntaxMatthieu Moy2010-09-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The documentation in revisions.txt did not match the implementation, and the comment in sha1_name.c was incomplete. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'js/maint-reflog-beyond-horizon'Junio C Hamano2010-09-031-9/+9
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * js/maint-reflog-beyond-horizon: t1503: fix broken test_must_fail calls rev-parse: tests git rev-parse --verify master@{n}, for various n sha1_name.c: use warning in preference to fprintf(stderr rev-parse: exit with non-zero status if ref@{n} is not valid.
| * | | sha1_name.c: use warning in preference to fprintf(stderrJon Seymour2010-08-241-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes sha1_name.c to use warning instead of fprintf(stderr). Trailing newlines from message formats have been removed since warning adds one itself. Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | rev-parse: exit with non-zero status if ref@{n} is not valid.Jon Seymour2010-08-241-4/+5
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "The current behaviour of ref@{...} syntax parser is suboptimal: $ git rev-parse --verify jch@{99999} && echo true warning: Log for 'jch' only has 1368 entries. cfb88e9a8d4926b0011ae2dd67e1f57a98f4b768 true It even knows that it is running off the cut-off point; it should just cause the caller to notice that fact. I don't think changing it to error out should cause any harm to existing callers." With this change: $ git rev-parse --verify jch@{99999} || echo false fatal: Log for 'jch' only has 1368 entries. false $ git rev-parse jch@{99999} || echo false fatal: Log for 'jch' only has 1368 entries. false Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/sha1-name-find-fix'Junio C Hamano2010-08-121-10/+11
|\ \ \ | |/ / |/| / | |/ | | | | | | | | * jc/sha1-name-find-fix: sha1_name.c: fix parsing of ":/token" syntax Conflicts: sha1_name.c
| * sha1_name.c: fix parsing of ":/token" syntaxJunio C Hamano2010-08-021-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parser tried to clean up the object flags it used while finding commits with matching string, but was not doing a very good job at it. This caused "checkout -b new ':/token'", which internally tries to parse ':/token' twice as an object name, to fail when the commit in question was reachable from only one ref. The mask bits given to pop_most_recent_commit(&list, MASK) means "I have already been on the list to be processed, so please do not place me again even if I am found to be a parent of some other commit on the list." So mark them when we add them to the list at the beginning. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'cp/textconv-cat-file'Junio C Hamano2010-06-271-5/+26
|\ \ | | | | | | | | | | | | | | | | | | | | | * cp/textconv-cat-file: git-cat-file.txt: Document --textconv t/t8007: test textconv support for cat-file textconv: support for cat_file sha1_name: add get_sha1_with_context()
| * | sha1_name: add get_sha1_with_context()Clément Poulain2010-06-181-5/+26
| |/ | | | | | | | | | | | | | | | | | | | | Textconv is defined by the diff driver, which is associated with a pathname, not a blob. This fonction permits to know the context for the sha1 you're looking for, especially his pathname Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr> Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr> Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Make :/ accept a regex rather than a fixed patternLinus Torvalds2010-06-141-3/+9
|/ | | | | | | | This also makes it trigger anywhere in the commit message, rather than just at the beginning. Which tends to be a lot more useful. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* sha1_name: fix segfault caused by invalid index accessMarkus Heidelberg2010-02-281-14/+18
| | | | | | | | The code to see if user input "git show :path" makes sense tried to access the index without properly checking the array bound. Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint-1.6.6' into maintJunio C Hamano2010-02-161-2/+1
|\ | | | | | | | | | | | | | | * maint-1.6.6: dwim_ref: fix dangling symref warning stash pop: remove 'apply' options during 'drop' invocation diff: make sure --output=/bad/path is caught Remove hyphen from "git-command" in two error messages
| * Merge branch 'maint-1.6.5' into maint-1.6.6Junio C Hamano2010-02-161-2/+1
| |\ | | | | | | | | | | | | | | | | | | * maint-1.6.5: dwim_ref: fix dangling symref warning stash pop: remove 'apply' options during 'drop' invocation diff: make sure --output=/bad/path is caught
| | * dwim_ref: fix dangling symref warningJeff King2010-02-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we encounter a symref that is dangling, in most cases we will warn about it. The one exception is a dangling HEAD, as that indicates a branch yet to be born. However, the check in dwim_ref was not quite right. If we were fed something like "HEAD^0" we would try to resolve "HEAD", see that it is dangling, and then check whether the _original_ string we got was "HEAD" (which it wasn't in this case). And that makes no sense; the dangling thing we found was not "HEAD^0" but rather "HEAD". Fixing this squelches a scary warning from "submodule summary HEAD" (and consequently "git status" with status.submodulesummary set) in an empty repo, as the submodule script calls "git rev-parse -q --verify HEAD^0". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | reject @{-1} not at beginning of object nameJeff King2010-01-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Something like foo@{-1} is nonsensical, as the @{-N} syntax is reserved for "the Nth last branch", and is not an actual reflog selector. We should not feed such nonsense to approxidate at all. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | fix parsing of @{-1}@{u} combinationJeff King2010-01-281-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously interpret_branch_name would see @{-1} and stop parsing, leaving the @{u} as cruft that provoked an error. Instead, we should recurse if there is more to parse. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/maint-reflog-bad-timestamp'Junio C Hamano2010-01-271-1/+4
|\ \ \ | |/ / | | | | | | | | | | | | | | | * jc/maint-reflog-bad-timestamp: t0101: use a fixed timestamp when searching in the reflog Update @{bogus.timestamp} fix not to die() approxidate_careful() reports errorneous date string
| * | Update @{bogus.timestamp} fix not to die()Junio C Hamano2010-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The caller will say "It is not a valid object name" if it wants to, and some callers may even try to see if it names an object and otherwise try to see if it is a path. Pointed out by Jeff King. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | approxidate_careful() reports errorneous date stringJunio C Hamano2010-01-261-1/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a long time, the time based reflog syntax (e.g. master@{yesterday}) didn't complain when the "human readable" timestamp was misspelled, as the underlying mechanism tried to be as lenient as possible. The funny thing was that parsing of "@{now}" even relied on the fact that anything not recognized by the machinery returned the current timestamp. Introduce approxidate_careful() that takes an optional pointer to an integer, that gets assigned 1 when the input does not make sense as a timestamp. As I am too lazy to fix all the callers that use approxidate(), most of the callers do not take advantage of the error checking, but convert the code to parse reflog to use it as a demonstration. Tests are mostly from Jeff King. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'js/refer-upstream'Junio C Hamano2010-01-221-13/+78
|\ \ | | | | | | | | | | | | | | | | | | * js/refer-upstream: Teach @{upstream} syntax to strbuf_branchanme() t1506: more test for @{upstream} syntax Introduce <branch>@{upstream} notation