A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gitster/git/commit/c21df07886bb07a893609ff242e29b1493da1fd8 below:

Merge branch 'jk/checkout-from-tree' · gitster/git@c21df07 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+35

-0

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+35

-0

lines changed Original file line number Diff line number Diff line change

@@ -67,6 +67,7 @@ static int update_some(const unsigned char *sha1, const char *base, int baselen,

67 67

{

68 68

int len;

69 69

struct cache_entry *ce;

70 +

int pos;

70 71 71 72

if (S_ISDIR(mode))

72 73

return READ_TREE_RECURSIVE;

@@ -79,6 +80,23 @@ static int update_some(const unsigned char *sha1, const char *base, int baselen,

79 80

ce->ce_flags = create_ce_flags(0) | CE_UPDATE;

80 81

ce->ce_namelen = len;

81 82

ce->ce_mode = create_ce_mode(mode);

83 + 84 +

/*

85 +

* If the entry is the same as the current index, we can leave the old

86 +

* entry in place. Whether it is UPTODATE or not, checkout_entry will

87 +

* do the right thing.

88 +

*/

89 +

pos = cache_name_pos(ce->name, ce->ce_namelen);

90 +

if (pos >= 0) {

91 +

struct cache_entry *old = active_cache[pos];

92 +

if (ce->ce_mode == old->ce_mode &&

93 +

!hashcmp(ce->sha1, old->sha1)) {

94 +

old->ce_flags |= CE_UPDATE;

95 +

free(ce);

96 +

return 0;

97 +

}

98 +

}

99 + 82 100

add_cache_entry(ce, ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE);

83 101

return 0;

84 102

}

Original file line number Diff line number Diff line change

@@ -61,4 +61,21 @@ test_expect_success 'do not touch unmerged entries matching $path but not in $tr

61 61

test_cmp expect.next0 actual.next0

62 62

'

63 63 64 +

test_expect_success 'do not touch files that are already up-to-date' '

65 +

git reset --hard &&

66 +

echo one >file1 &&

67 +

echo two >file2 &&

68 +

git add file1 file2 &&

69 +

git commit -m base &&

70 +

echo modified >file1 &&

71 +

test-chmtime =1000000000 file2 &&

72 +

git update-index -q --refresh &&

73 +

git checkout HEAD -- file1 file2 &&

74 +

echo one >expect &&

75 +

test_cmp expect file1 &&

76 +

echo "1000000000 file2" >expect &&

77 +

test-chmtime -v +0 file2 >actual &&

78 +

test_cmp expect actual

79 +

'

80 + 64 81

test_done

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4