зеркало из https://github.com/microsoft/git.git
Merge branch 'rs/add-dry-run-without-objects'
Stop "git add --dry-run" from creating new blob and tree objects. * rs/add-dry-run-without-objects: add: don't write objects with --dry-run
This commit is contained in:
Коммит
6ffb5fc069
|
@ -738,7 +738,7 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st,
|
||||||
int intent_only = flags & ADD_CACHE_INTENT;
|
int intent_only = flags & ADD_CACHE_INTENT;
|
||||||
int add_option = (ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE|
|
int add_option = (ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE|
|
||||||
(intent_only ? ADD_CACHE_NEW_ONLY : 0));
|
(intent_only ? ADD_CACHE_NEW_ONLY : 0));
|
||||||
int hash_flags = HASH_WRITE_OBJECT;
|
unsigned hash_flags = pretend ? 0 : HASH_WRITE_OBJECT;
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
|
|
||||||
if (flags & ADD_CACHE_RENORMALIZE)
|
if (flags & ADD_CACHE_RENORMALIZE)
|
||||||
|
|
|
@ -129,12 +129,15 @@ test_expect_success 'add -n -u should not add but just report' '
|
||||||
echo "remove '\''top'\''"
|
echo "remove '\''top'\''"
|
||||||
) >expect &&
|
) >expect &&
|
||||||
before=$(git ls-files -s check top) &&
|
before=$(git ls-files -s check top) &&
|
||||||
|
git count-objects -v >objects_before &&
|
||||||
echo changed >>check &&
|
echo changed >>check &&
|
||||||
rm -f top &&
|
rm -f top &&
|
||||||
git add -n -u >actual &&
|
git add -n -u >actual &&
|
||||||
after=$(git ls-files -s check top) &&
|
after=$(git ls-files -s check top) &&
|
||||||
|
git count-objects -v >objects_after &&
|
||||||
|
|
||||||
test "$before" = "$after" &&
|
test "$before" = "$after" &&
|
||||||
|
test_cmp objects_before objects_after &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
Загрузка…
Ссылка в новой задаче