Skip to content

Commit

Permalink
Merge pull request #339 from sth0/sth-ignore-timestamps
Browse files Browse the repository at this point in the history
Patch to ignore timestamps with -t option for smaller transcripts.
  • Loading branch information
magnusviri authored Feb 16, 2024
2 parents ad1e271 + 82089f5 commit 797812b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
7 changes: 6 additions & 1 deletion fsdiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ int dotfd;
int lastpercent = -1;
int case_sensitive = 1;
int tran_format = -1;
int ignore_timestamps = 0;
extern int exclude_warnings;
const EVP_MD *md;

Expand Down Expand Up @@ -401,7 +402,7 @@ main( int argc, char **argv )
cksum = 0;
outtran = stdout;

while (( c = getopt( argc, argv, "%1ACc:IK:o:VvW" )) != EOF ) {
while (( c = getopt( argc, argv, "%1ACc:IK:o:tVvW" )) != EOF ) {
switch( c ) {
case '%':
case 'v':
Expand Down Expand Up @@ -455,6 +456,10 @@ main( int argc, char **argv )
exclude_warnings = 1;
break;

case 't': /* ignore files for which only the time has changed */
ignore_timestamps = 1;
break;

case '?':
printf( "bad %c\n", c );
errflag++;
Expand Down
5 changes: 4 additions & 1 deletion man/fsdiff.1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
|
.B -1
} [
.BI -IVW
.BI -IVWt
] [
.BI \-K\ command
] [
Expand Down Expand Up @@ -312,6 +312,9 @@ order of preference and then exits.
prints a warning to the standard error when encountering an object
matching an exclude pattern.
.sp
.TP 19
.B \-t
ignores files where only the timestamp has changed.
.SH FILES
.TP 19
.B _RADMIND_COMMANDFILE
Expand Down
16 changes: 10 additions & 6 deletions transcript.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@ static struct transcript *prev_tran = NULL;
extern int edit_path;
extern int case_sensitive;
extern int tran_format;
extern int ignore_timestamps;
static char *kdir;
static struct list *kfile_list;
struct list *special_list;
struct list *exclude_list;

char *path_prefix = NULL;
int edit_path;
int ignore_timestamps;
int skip = 0;
int cksum;
int fs_minus;
Expand Down Expand Up @@ -550,14 +552,16 @@ t_compare( struct pathinfo *fs, struct transcript *tran )
t_print( fs, tran, PR_DOWNLOAD );
break;
}
} else if ( fs->pi_stat.st_mtime != tran->t_pinfo.pi_stat.st_mtime ) {
t_print( fs, tran, PR_DOWNLOAD );
break;
} else if ( ignore_timestamps == 0 &&
fs->pi_stat.st_mtime != tran->t_pinfo.pi_stat.st_mtime) {
t_print( fs, tran, PR_DOWNLOAD );
break;
}

if ( fs->pi_stat.st_mtime != tran->t_pinfo.pi_stat.st_mtime ) {
t_print( fs, tran, PR_STATUS );
break;
if ( ignore_timestamps == 0 &&
fs->pi_stat.st_mtime != tran->t_pinfo.pi_stat.st_mtime ) {
t_print( fs, tran, PR_STATUS );
break;
}
}

Expand Down

0 comments on commit 797812b

Please sign in to comment.