diff options
author | John Cai <johncai86@gmail.com> | 2023-05-06 07:15:29 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-05-07 00:34:09 +0300 |
commit | 44451a2e5eec5360378be23e2cdbd9ecee49e14e (patch) | |
tree | e5ff5d8d9337a5c5b76440583ea4f7d9e2c63880 /ll-merge.c | |
parent | 48d89b51b3bb8a60580c36731b96a7206ce1e5b9 (diff) |
attr: teach "--attr-source=<tree>" global option to "git"
Earlier, 47cfc9bd (attr: add flag `--source` to work with tree-ish,
2023-01-14) taught "git check-attr" the "--source=<tree>" option to
allow it to read attribute files from a tree-ish, but did so only
for the command. Just like "check-attr" users wanted a way to use
attributes from a tree-ish and not from the working tree files,
users of other commands (like "git diff") would benefit from the
same.
Undo most of the UI change the commit made, while keeping the
internal logic to read attributes from a given tree-ish. Expose the
internal logic via a new "--attr-source=<tree>" command line option
given to "git", so that it can be used with any git command that
runs as part of the main git process.
Additionally, add an environment variable GIT_ATTR_SOURCE that is set
when --attr-source is passed in, so that subprocesses use the same value
for the attributes source tree.
Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'll-merge.c')
-rw-r--r-- | ll-merge.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ll-merge.c b/ll-merge.c index 28bc94c45d..6580970a67 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -393,7 +393,7 @@ enum ll_merge_result ll_merge(mmbuffer_t *result_buf, normalize_file(theirs, path, istate); } - git_check_attr(istate, NULL, path, check); + git_check_attr(istate, path, check); ll_driver_name = check->items[0].value; if (check->items[1].value) { marker_size = atoi(check->items[1].value); @@ -421,7 +421,7 @@ int ll_merge_marker_size(struct index_state *istate, const char *path) if (!check) check = attr_check_initl("conflict-marker-size", NULL); - git_check_attr(istate, NULL, path, check); + git_check_attr(istate, path, check); if (check->items[0].value) { marker_size = atoi(check->items[0].value); if (marker_size <= 0) |