git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 2/3] sha1_name: get_sha1_with_context learns to follow symlinks

From
Junio C Hamano <gitster@pobox.com>
Date
May 11, 2015, 19:42 UTC
Message-ID
<xmqqh9ri3nps.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1431366989-7405-3-git-send-email-dturner@twopensource.com>
dturner@twopensource.com writes:
Show 38 quoted lines
> From: David Turner <dturner@twitter.com>
>
> Wire up get_sha1_with_context to call get_tree_entry_follow_symlinks
> when GET_SHA1_FOLLOW_SYMLINKS is passed in flags. G_S_FOLLOW_SYMLINKS
> is incompatible with G_S_ONLY_TO_DIE because the diagnosis
> that ONLY_TO_DIE triggers does not at present consider symlinks, and
> it would be a significant amount of additional code to allow it to
> do so.
>
> Signed-off-by: David Turner <dturner@twitter.com>
> ---
>  cache.h     | 20 +++++++++++++-------
>  sha1_name.c | 20 +++++++++++++++-----
>  2 files changed, 28 insertions(+), 12 deletions(-)
>
> diff --git a/cache.h b/cache.h
> index 3d3244b..65505d1 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -922,15 +922,21 @@ struct object_context {
>  	unsigned char tree[20];
>  	char path[PATH_MAX];
>  	unsigned mode;
> +	/*
> +	 * symlink_path is only used by get_tree_entry_follow_symlinks,
> +	 * and only for symlinks that point outside the repository.
> +	 */
> +	struct strbuf symlink_path;
>  };
>...
> @@ -1469,5 +1477,7 @@ void maybe_die_on_misspelt_object_name(const char *name, const char *prefix)
>  
>  int get_sha1_with_context(const char *str, unsigned flags, unsigned char *sha1, struct object_context *orc)
>  {
> +	if (flags & GET_SHA1_FOLLOW_SYMLINKS && flags & GET_SHA1_ONLY_TO_DIE)
> +		die("BUG: incompatible flags for get_sha1_with_context");
>  	return get_sha1_with_context_1(str, flags, NULL, sha1, orc);
>  }
Looks good; thanks.
Previous: dturner@twopensource.comNext: dturner@twopensource.com
Message 4 of 8 in “(unknown)”
  1. dturner@twopensource.comMay 11, 2015
  2. 1/3 tree-walk: learn get_tree_entry_follow_symlinksdturner@twopensource.com, May 11, 2015
  3. 2/3 sha1_name: get_sha1_with_context learns to follow symlinksdturner@twopensource.com, May 11, 2015
  4. Junio C HamanoMay 11, 2015
  5. 3/3 cat-file: add --follow-symlinks to --batchdturner@twopensource.com, May 11, 2015
  6. Junio C HamanoMay 11, 2015
  7. David TurnerMay 11, 2015
  8. Junio C HamanoMay 11, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.