diff options
Diffstat (limited to 'wt-status.c')
| -rw-r--r-- | wt-status.c | 43 | 
1 files changed, 17 insertions, 26 deletions
diff --git a/wt-status.c b/wt-status.c index 454601afa1..8ffe6d3988 100644 --- a/wt-status.c +++ b/wt-status.c @@ -148,7 +148,7 @@ void wt_status_prepare(struct repository *r, struct wt_status *s)  	memcpy(s->color_palette, default_wt_status_colors,  	       sizeof(default_wt_status_colors));  	s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES; -	s->use_color = -1; +	s->use_color = GIT_COLOR_UNKNOWN;  	s->relative_paths = 1;  	s->branch = refs_resolve_refdup(get_main_ref_store(the_repository),  					"HEAD", 0, NULL, NULL); @@ -972,7 +972,8 @@ static void wt_longstatus_print_changed(struct wt_status *s)  	wt_longstatus_print_trailer(s);  } -static int stash_count_refs(struct object_id *ooid UNUSED, +static int stash_count_refs(const char *refname UNUSED, +			    struct object_id *ooid UNUSED,  			    struct object_id *noid UNUSED,  			    const char *email UNUSED,  			    timestamp_t timestamp UNUSED, int tz UNUSED, @@ -1164,7 +1165,7 @@ static void wt_longstatus_print_verbose(struct wt_status *s)  	 * before.  	 */  	if (s->fp != stdout) { -		rev.diffopt.use_color = 0; +		rev.diffopt.use_color = GIT_COLOR_NEVER;  		wt_status_add_cut_line(s);  	}  	if (s->verbose > 1 && s->committable) { @@ -1351,8 +1352,8 @@ static int split_commit_in_progress(struct wt_status *s)   */  static void abbrev_oid_in_line(struct strbuf *line)  { -	struct strbuf **split; -	int i; +	struct string_list split = STRING_LIST_INIT_DUP; +	struct object_id oid;  	if (starts_with(line->buf, "exec ") ||  	    starts_with(line->buf, "x ") || @@ -1360,26 +1361,15 @@ static void abbrev_oid_in_line(struct strbuf *line)  	    starts_with(line->buf, "l "))  		return; -	split = strbuf_split_max(line, ' ', 3); -	if (split[0] && split[1]) { -		struct object_id oid; - -		/* -		 * strbuf_split_max left a space. Trim it and re-add -		 * it after abbreviation. -		 */ -		strbuf_trim(split[1]); -		if (!repo_get_oid(the_repository, split[1]->buf, &oid)) { -			strbuf_reset(split[1]); -			strbuf_add_unique_abbrev(split[1], &oid, -						 DEFAULT_ABBREV); -			strbuf_addch(split[1], ' '); -			strbuf_reset(line); -			for (i = 0; split[i]; i++) -				strbuf_addbuf(line, split[i]); -		} +	if ((2 <= string_list_split(&split, line->buf, " ", 2)) && +	    !repo_get_oid(the_repository, split.items[1].string, &oid)) { +		strbuf_reset(line); +		strbuf_addf(line, "%s ", split.items[0].string); +		strbuf_add_unique_abbrev(line, &oid, DEFAULT_ABBREV); +		for (size_t i = 2; i < split.nr; i++) +			strbuf_addf(line, " %s", split.items[i].string);  	} -	strbuf_list_free(split); +	string_list_clear(&split, 0);  }  static int read_rebase_todolist(const char *fname, struct string_list *lines) @@ -1664,7 +1654,8 @@ struct grab_1st_switch_cbdata {  	struct object_id noid;  }; -static int grab_1st_switch(struct object_id *ooid UNUSED, +static int grab_1st_switch(const char *refname UNUSED, +			   struct object_id *ooid UNUSED,  			   struct object_id *noid,  			   const char *email UNUSED,  			   timestamp_t timestamp UNUSED, int tz UNUSED, @@ -2164,7 +2155,7 @@ static void wt_shortstatus_print(struct wt_status *s)  static void wt_porcelain_print(struct wt_status *s)  { -	s->use_color = 0; +	s->use_color = GIT_COLOR_NEVER;  	s->relative_paths = 0;  	s->prefix = NULL;  	s->no_gettext = 1;  | 
