|
1
|
# |
|
2
|
# Copyright (c) 2026 Dan Shearer |
|
3
|
# |
|
4
|
# This program is free software; you can redistribute it and/or |
|
5
|
# modify it under the terms of the Simplified BSD License (also |
|
6
|
# known as the "2-Clause License" or "FreeBSD License".) |
|
7
|
# |
|
8
|
# This program is distributed in the hope that it will be useful, |
|
9
|
# but without any warranty; without even the implied warranty of |
|
10
|
# merchantability or fitness for a particular purpose. |
|
11
|
# |
|
12
|
############################################################################ |
|
13
|
# |
|
14
|
# "fossil git export" of a check-in that holds a shunned file. The |
|
15
|
# file is to be exported as an empty file. An earlier fossil left the |
|
16
|
# check-in out of the export and exited with status 0. |
|
17
|
# |
|
18
|
|
|
19
|
require_no_open_checkout |
|
20
|
|
|
21
|
if {[catch {exec git --version}]} { |
|
22
|
test_skip "git is not installed" |
|
23
|
} |
|
24
|
|
|
25
|
test_setup |
|
26
|
|
|
27
|
write_file keep.txt "keep\n" |
|
28
|
write_file shun.txt "first version\n" |
|
29
|
fossil add keep.txt shun.txt |
|
30
|
fossil commit -m "first" |
|
31
|
write_file shun.txt "second version, to be shunned\n" |
|
32
|
fossil commit -m "second" |
|
33
|
fossil sql "INSERT OR IGNORE INTO shun(uuid,mtime)\ |
|
34
|
SELECT b.uuid, 0 FROM blob b, mlink m, filename f\ |
|
35
|
WHERE m.fid=b.rid AND f.fnid=m.fnid AND f.name='shun.txt'\ |
|
36
|
AND m.mid=(SELECT max(mid) FROM mlink)" |
|
37
|
fossil rebuild |
|
38
|
|
|
39
|
# git writes progress to standard error, which the "fossil" procedure |
|
40
|
# counts as a failure. |
|
41
|
fossil_raw git export git-mirror |
|
42
|
test git-export-shunned-status {$CODE == 0} |
|
43
|
set gitexportLog [exec git -C git-mirror log --format=%s] |
|
44
|
test git-export-shunned-checkin {[string first second $gitexportLog] >= 0} |
|
45
|
set gitexportNew [exec git -C git-mirror cat-file -p HEAD:shun.txt] |
|
46
|
test git-export-shunned-empty {[string length $gitexportNew] == 0} |
|
47
|
set gitexportOld [exec git -C git-mirror cat-file -p HEAD~1:shun.txt] |
|
48
|
test git-export-shunned-older {$gitexportOld eq "first version"} |
|
49
|
|
|
50
|
test_cleanup |
|
51
|
|