@@ -22,15 +22,15 @@ static int rerere_autoupdate;
22
22
23
23
static char * merge_rr_path ;
24
24
25
- const char * rerere_path (const char * hex , const char * file )
25
+ const char * rerere_path (const char * id , const char * file )
26
26
{
27
- return git_path ("rr-cache/%s/%s" , hex , file );
27
+ return git_path ("rr-cache/%s/%s" , id , file );
28
28
}
29
29
30
- static int has_rerere_resolution (const char * hex )
30
+ static int has_rerere_resolution (const char * id )
31
31
{
32
32
struct stat st ;
33
- return !stat (rerere_path (hex , "postimage" ), & st );
33
+ return !stat (rerere_path (id , "postimage" ), & st );
34
34
}
35
35
36
36
/*
@@ -539,7 +539,7 @@ int rerere_remaining(struct string_list *merge_rr)
539
539
}
540
540
541
541
/*
542
- * Find the conflict identified by "name "; the change between its
542
+ * Find the conflict identified by "id "; the change between its
543
543
* "preimage" (i.e. a previous contents with conflict markers) and its
544
544
* "postimage" (i.e. the corresponding contents with conflicts
545
545
* resolved) may apply cleanly to the contents stored in "path", i.e.
@@ -548,7 +548,7 @@ int rerere_remaining(struct string_list *merge_rr)
548
548
* Returns 0 for successful replay of recorded resolution, or non-zero
549
549
* for failure.
550
550
*/
551
- static int merge (const char * name , const char * path )
551
+ static int merge (const char * id , const char * path )
552
552
{
553
553
int ret ;
554
554
mmfile_t cur = {NULL , 0 }, base = {NULL , 0 }, other = {NULL , 0 };
@@ -558,12 +558,12 @@ static int merge(const char *name, const char *path)
558
558
* Normalize the conflicts in path and write it out to
559
559
* "thisimage" temporary file.
560
560
*/
561
- if (handle_file (path , NULL , rerere_path (name , "thisimage" )) < 0 )
561
+ if (handle_file (path , NULL , rerere_path (id , "thisimage" )) < 0 )
562
562
return 1 ;
563
563
564
- if (read_mmfile (& cur , rerere_path (name , "thisimage" )) ||
565
- read_mmfile (& base , rerere_path (name , "preimage" )) ||
566
- read_mmfile (& other , rerere_path (name , "postimage" ))) {
564
+ if (read_mmfile (& cur , rerere_path (id , "thisimage" )) ||
565
+ read_mmfile (& base , rerere_path (id , "preimage" )) ||
566
+ read_mmfile (& other , rerere_path (id , "postimage" ))) {
567
567
ret = 1 ;
568
568
goto out ;
569
569
}
@@ -580,9 +580,9 @@ static int merge(const char *name, const char *path)
580
580
* A successful replay of recorded resolution.
581
581
* Mark that "postimage" was used to help gc.
582
582
*/
583
- if (utime (rerere_path (name , "postimage" ), NULL ) < 0 )
583
+ if (utime (rerere_path (id , "postimage" ), NULL ) < 0 )
584
584
warning ("failed utime() on %s: %s" ,
585
- rerere_path (name , "postimage" ),
585
+ rerere_path (id , "postimage" ),
586
586
strerror (errno ));
587
587
588
588
/* Update "path" with the resolution */
@@ -640,11 +640,11 @@ static void do_rerere_one_path(struct string_list_item *rr_item,
640
640
struct string_list * update )
641
641
{
642
642
const char * path = rr_item -> string ;
643
- const char * name = (const char * )rr_item -> util ;
643
+ const char * id = (const char * )rr_item -> util ;
644
644
645
645
/* Is there a recorded resolution we could attempt to apply? */
646
- if (has_rerere_resolution (name )) {
647
- if (merge (name , path ))
646
+ if (has_rerere_resolution (id )) {
647
+ if (merge (id , path ))
648
648
return ; /* failed to replay */
649
649
650
650
if (rerere_autoupdate )
@@ -655,7 +655,7 @@ static void do_rerere_one_path(struct string_list_item *rr_item,
655
655
path );
656
656
} else if (!handle_file (path , NULL , NULL )) {
657
657
/* The user has resolved it. */
658
- copy_file (rerere_path (name , "postimage" ), path , 0666 );
658
+ copy_file (rerere_path (id , "postimage" ), path , 0666 );
659
659
fprintf (stderr , "Recorded resolution for '%s'.\n" , path );
660
660
} else {
661
661
return ;
@@ -680,7 +680,7 @@ static int do_plain_rerere(struct string_list *rr, int fd)
680
680
*/
681
681
for (i = 0 ; i < conflict .nr ; i ++ ) {
682
682
unsigned char sha1 [20 ];
683
- char * hex ;
683
+ char * id ;
684
684
int ret ;
685
685
const char * path = conflict .items [i ].string ;
686
686
@@ -695,8 +695,8 @@ static int do_plain_rerere(struct string_list *rr, int fd)
695
695
ret = handle_file (path , sha1 , NULL );
696
696
if (ret < 1 )
697
697
continue ;
698
- hex = xstrdup (sha1_to_hex (sha1 ));
699
- string_list_insert (rr , path )-> util = hex ;
698
+ id = xstrdup (sha1_to_hex (sha1 ));
699
+ string_list_insert (rr , path )-> util = id ;
700
700
701
701
/*
702
702
* If the directory does not exist, create
@@ -706,15 +706,15 @@ static int do_plain_rerere(struct string_list *rr, int fd)
706
706
* NEEDSWORK: make sure "gc" does not remove
707
707
* preimage without removing the directory.
708
708
*/
709
- if (mkdir_in_gitdir (git_path ("rr-cache/%s" , hex )))
709
+ if (mkdir_in_gitdir (git_path ("rr-cache/%s" , id )))
710
710
continue ;
711
711
712
712
/*
713
713
* We are the first to encounter this
714
714
* conflict. Ask handle_file() to write the
715
715
* normalized contents to the "preimage" file.
716
716
*/
717
- handle_file (path , NULL , rerere_path (hex , "preimage" ));
717
+ handle_file (path , NULL , rerere_path (id , "preimage" ));
718
718
fprintf (stderr , "Recorded preimage for '%s'\n" , path );
719
719
}
720
720
@@ -788,7 +788,7 @@ int rerere(int flags)
788
788
static int rerere_forget_one_path (const char * path , struct string_list * rr )
789
789
{
790
790
const char * filename ;
791
- char * hex ;
791
+ char * id ;
792
792
unsigned char sha1 [20 ];
793
793
int ret ;
794
794
struct string_list_item * item ;
@@ -802,8 +802,8 @@ static int rerere_forget_one_path(const char *path, struct string_list *rr)
802
802
return error ("Could not parse conflict hunks in '%s'" , path );
803
803
804
804
/* Nuke the recorded resolution for the conflict */
805
- hex = xstrdup (sha1_to_hex (sha1 ));
806
- filename = rerere_path (hex , "postimage" );
805
+ id = xstrdup (sha1_to_hex (sha1 ));
806
+ filename = rerere_path (id , "postimage" );
807
807
if (unlink (filename ))
808
808
return (errno == ENOENT
809
809
? error ("no remembered resolution for %s" , path )
@@ -814,7 +814,7 @@ static int rerere_forget_one_path(const char *path, struct string_list *rr)
814
814
* conflict in the working tree, run us again to record
815
815
* the postimage.
816
816
*/
817
- handle_cache (path , sha1 , rerere_path (hex , "preimage" ));
817
+ handle_cache (path , sha1 , rerere_path (id , "preimage" ));
818
818
fprintf (stderr , "Updated preimage for '%s'\n" , path );
819
819
820
820
/*
@@ -823,7 +823,7 @@ static int rerere_forget_one_path(const char *path, struct string_list *rr)
823
823
*/
824
824
item = string_list_insert (rr , path );
825
825
free (item -> util );
826
- item -> util = hex ;
826
+ item -> util = id ;
827
827
fprintf (stderr , "Forgot resolution for %s\n" , path );
828
828
return 0 ;
829
829
}
@@ -859,32 +859,32 @@ int rerere_forget(struct pathspec *pathspec)
859
859
/*
860
860
* Garbage collection support
861
861
*/
862
- static time_t rerere_created_at (const char * name )
862
+ static time_t rerere_created_at (const char * id )
863
863
{
864
864
struct stat st ;
865
- return stat (rerere_path (name , "preimage" ), & st ) ? (time_t ) 0 : st .st_mtime ;
865
+ return stat (rerere_path (id , "preimage" ), & st ) ? (time_t ) 0 : st .st_mtime ;
866
866
}
867
867
868
- static time_t rerere_last_used_at (const char * name )
868
+ static time_t rerere_last_used_at (const char * id )
869
869
{
870
870
struct stat st ;
871
- return stat (rerere_path (name , "postimage" ), & st ) ? (time_t ) 0 : st .st_mtime ;
871
+ return stat (rerere_path (id , "postimage" ), & st ) ? (time_t ) 0 : st .st_mtime ;
872
872
}
873
873
874
874
/*
875
875
* Remove the recorded resolution for a given conflict ID
876
876
*/
877
- static void unlink_rr_item (const char * name )
877
+ static void unlink_rr_item (const char * id )
878
878
{
879
- unlink (rerere_path (name , "thisimage" ));
880
- unlink (rerere_path (name , "preimage" ));
881
- unlink (rerere_path (name , "postimage" ));
879
+ unlink (rerere_path (id , "thisimage" ));
880
+ unlink (rerere_path (id , "preimage" ));
881
+ unlink (rerere_path (id , "postimage" ));
882
882
/*
883
883
* NEEDSWORK: what if this rmdir() fails? Wouldn't we then
884
884
* assume that we already have preimage recorded in
885
885
* do_plain_rerere()?
886
886
*/
887
- rmdir (git_path ("rr-cache/%s" , name ));
887
+ rmdir (git_path ("rr-cache/%s" , id ));
888
888
}
889
889
890
890
void rerere_gc (struct string_list * rr )
@@ -939,9 +939,9 @@ void rerere_clear(struct string_list *merge_rr)
939
939
int i ;
940
940
941
941
for (i = 0 ; i < merge_rr -> nr ; i ++ ) {
942
- const char * name = (const char * )merge_rr -> items [i ].util ;
943
- if (!has_rerere_resolution (name ))
944
- unlink_rr_item (name );
942
+ const char * id = (const char * )merge_rr -> items [i ].util ;
943
+ if (!has_rerere_resolution (id ))
944
+ unlink_rr_item (id );
945
945
}
946
946
unlink_or_warn (git_path ("MERGE_RR" ));
947
947
}
0 commit comments