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

Re: [PATCH] add: add --chmod=+x / --chmod=-x options

From
Junio C Hamano <gitster@pobox.com>
Date
May 31, 2016, 22:34 UTC
Message-ID
<xmqqtwhd3lht.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160531220818.GB46739@zoidberg>
Edward Thomson <ethomson@edwardthomson.com> writes:
> +static char *chmod_arg = NULL;
> +

I'll drop " = NULL", as it is our convention to let BSS take care of the zero initialization for global variables as much as possible.

Other than that, I did not see anything objectionable in this round, but I did notice that you kept the "this takes two bits out of 32" Dscho mentioned--I do not have a strong preference either way, so I'll queue it (at least tentatively) on 'pu'.

Show 21 quoted lines
> @@ -346,7 +354,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
>  		 (intent_to_add ? ADD_CACHE_INTENT : 0) |
>  		 (ignore_add_errors ? ADD_CACHE_IGNORE_ERRORS : 0) |
>  		 (!(addremove || take_worktree_changes)
> -		  ? ADD_CACHE_IGNORE_REMOVAL : 0));
> +		  ? ADD_CACHE_IGNORE_REMOVAL : 0)) |
> +		 (chmod_arg && *chmod_arg == '+' ? ADD_CACHE_FORCE_EXECUTABLE : 0) |
> +		 (chmod_arg && *chmod_arg == '-' ? ADD_CACHE_FORCE_NOTEXECUTABLE : 0);
>  
>  	if (require_pathspec && argc == 0) {
>  		fprintf(stderr, _("Nothing specified, nothing added.\n"));
> diff --git a/cache.h b/cache.h
> index 6049f86..da03cd9 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -581,6 +581,8 @@ extern int remove_file_from_index(struct index_state *, const char *path);
>  #define ADD_CACHE_IGNORE_ERRORS	4
>  #define ADD_CACHE_IGNORE_REMOVAL 8
>  #define ADD_CACHE_INTENT 16
> +#define ADD_CACHE_FORCE_EXECUTABLE 32
> +#define ADD_CACHE_FORCE_NOTEXECUTABLE 64
Previous: Edward ThomsonNext: Johannes Schindelin
Message 2 of 8 in “add: add --chmod=+x / --chmod=-x options”
  1. add: add --chmod=+x / --chmod=-x optionsEdward Thomson, May 31, 2016
  2. Junio C HamanoMay 31, 2016
  3. Johannes SchindelinJun 1, 2016
  4. Johannes SchindelinJun 1, 2016
  5. Junio C HamanoJun 1, 2016
  6. Edward ThomsonJun 7, 2016
  7. Junio C HamanoJun 8, 2016
  8. Duy NguyenJun 8, 2016

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.