Skip to content

Commit 1d21112

Browse files
committed
Merge branch 'di/fast-import-doc'
* di/fast-import-doc: doc/fast-import: document feature import-marks-if-exists
2 parents 7abd8fb + 3beb4fc commit 1d21112

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

Documentation/git-fast-import.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,10 +1012,14 @@ force::
10121012
(see OPTIONS, above).
10131013

10141014
import-marks::
1015+
import-marks-if-exists::
10151016
Like --import-marks except in two respects: first, only one
1016-
"feature import-marks" command is allowed per stream;
1017-
second, an --import-marks= command-line option overrides
1018-
any "feature import-marks" command in the stream.
1017+
"feature import-marks" or "feature import-marks-if-exists"
1018+
command is allowed per stream; second, an --import-marks=
1019+
or --import-marks-if-exists command-line option overrides
1020+
any of these "feature" commands in the stream; third,
1021+
"feature import-marks-if-exists" like a corresponding
1022+
command-line option silently skips a nonexistent file.
10191023

10201024
cat-blob::
10211025
ls::

t/t9300-fast-import.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,53 @@ test_expect_success 'R: --import-marks-if-exists' '
18821882
test_cmp expect io.marks
18831883
'
18841884

1885+
test_expect_success 'R: feature import-marks-if-exists' '
1886+
rm -f io.marks &&
1887+
>expect &&
1888+
1889+
git fast-import --export-marks=io.marks <<-\EOF &&
1890+
feature import-marks-if-exists=not_io.marks
1891+
EOF
1892+
test_cmp expect io.marks &&
1893+
1894+
blob=$(echo hi | git hash-object --stdin) &&
1895+
1896+
echo ":1 $blob" >io.marks &&
1897+
echo ":1 $blob" >expect &&
1898+
echo ":2 $blob" >>expect &&
1899+
1900+
git fast-import --export-marks=io.marks <<-\EOF &&
1901+
feature import-marks-if-exists=io.marks
1902+
blob
1903+
mark :2
1904+
data 3
1905+
hi
1906+
1907+
EOF
1908+
test_cmp expect io.marks &&
1909+
1910+
echo ":3 $blob" >>expect &&
1911+
1912+
git fast-import --import-marks=io.marks \
1913+
--export-marks=io.marks <<-\EOF &&
1914+
feature import-marks-if-exists=not_io.marks
1915+
blob
1916+
mark :3
1917+
data 3
1918+
hi
1919+
1920+
EOF
1921+
test_cmp expect io.marks &&
1922+
1923+
>expect &&
1924+
1925+
git fast-import --import-marks-if-exists=not_io.marks \
1926+
--export-marks=io.marks <<-\EOF
1927+
feature import-marks-if-exists=io.marks
1928+
EOF
1929+
test_cmp expect io.marks
1930+
'
1931+
18851932
cat >input << EOF
18861933
feature import-marks=marks.out
18871934
feature export-marks=marks.new

0 commit comments

Comments
 (0)