From: Eric Wong <e@80x24.org> To: David Turner <novalis@novalis.org> Cc: git@vger.kernel.org Subject: Re: cat-file ambiguity prints "dangling" Date: Fri, 18 Jan 2019 10:45:19 +0000 [thread overview] Message-ID: <20190118104519.fqpzirux5qulkcwa@dcvr> (raw) In-Reply-To: <a7307f431e2231dd420a0190a22aa38094cd593f.camel@novalis.org> David Turner <novalis@novalis.org> wrote: > It appears that get_oid_with_context calls into get_short_oid for that > case, and get_short_oid returns SHORT_NAME_AMBIGUOUS, which is -2. We > treat that as DANGLING_SYMLINK, which also seems to have the value -2. > So, it's an ambiguity in ambiguity resolution. > > Fix attached. Thanks for the quick response. Unfortunately, the patch makes the situation worse for me... > diff --git a/builtin/cat-file.c b/builtin/cat-file.c > index 2ca56fd086..f2344b199f 100644 > --- a/builtin/cat-file.c > +++ b/builtin/cat-file.c > @@ -380,7 +380,7 @@ static void batch_one_object(const char *obj_name, > { > struct object_context ctx; > int flags = opt->follow_symlinks ? GET_OID_FOLLOW_SYMLINKS : 0; > - enum follow_symlinks_result result; > + enum get_oid_result result; > > result = get_oid_with_context(obj_name, flags, &data->oid, &ctx); > if (result != FOUND) { > @@ -388,6 +388,9 @@ static void batch_one_object(const char *obj_name, > case MISSING_OBJECT: > printf("%s missing\n", obj_name); > break; > + case SHORT_NAME_AMBIGUOUS: > + /* We've already printed the ambiguous message */ > + break; Because the message about ambiguity only goes to stderr. Something needs to go to stdout, or else the reader process would hang forever. I've already updated my code[1] to work around "dangling", but maybe printing "ambiguous" similar to the "missing" message would be appropriate? Something like: case SHORT_NAME_AMBIGUOUS: printf("%s ambiguous\n", obj_name); break; (Along with a manpage update) [1] new stuff for public-inbox on the way :>
next prev parent reply other threads:[~2019-01-18 10:45 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-18 3:38 Eric Wong 2019-01-18 4:46 ` David Turner 2019-01-18 10:45 ` Eric Wong [this message] 2019-01-18 16:20 ` David Turner 2019-01-18 22:26 ` [PATCH] t1512: test ambiguous cat-file --batch and --batch-output Eric Wong 2019-01-18 22:29 ` David Turner 2019-01-23 11:11 ` SZEDER Gábor 2019-01-30 21:33 ` [PATCH v2] " Eric Wong
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190118104519.fqpzirux5qulkcwa@dcvr \ --to=e@80x24.org \ --cc=git@vger.kernel.org \ --cc=novalis@novalis.org \ --subject='Re: cat-file ambiguity prints "dangling"' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).