Fossil

Check-in [960c9e8b]
Login

Check-in [960c9e8b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Better fix for the case of doing a "fossil diff" on a checkout that includes a merge and specifying a --from clause that is the branch that was merged from.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 960c9e8bd69531ebca9664afadd49326b1d336c877bdd7253eae000e6d5203c6
User & Date: drh 2021-10-19 19:25:11
Context
2021-10-21
01:15
Improve help text of login-group command. Mention about the -R|--repository option and format subcommand description to follow a bit more the conventions of other commands. ... (check-in: b9107e42 user: mgagnon tags: trunk)
2021-10-19
19:25
Better fix for the case of doing a "fossil diff" on a checkout that includes a merge and specifying a --from clause that is the branch that was merged from. ... (check-in: 960c9e8b user: drh tags: trunk)
2021-10-18
12:45
Removed an incorrect hash result from www/password.wiki, per forum post 3375879e6c3b9d73. ... (check-in: 2169f323 user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diffcmd.c.

549
550
551
552
553
554
555



















556
557
558
559
560
561
562
    file_delete(blob_str(&temp2));

    blob_reset(&temp1);
    blob_reset(&temp2);
    blob_reset(&cmd);
  }
}




















/*
** Run a diff between the version zFrom and files on disk.  zFrom might
** be NULL which means to simply show the difference between the edited
** files on disk and the check-out on which they are based.
**
** Use the internal diff logic if zDiffCmd is NULL.  Otherwise call the







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
    file_delete(blob_str(&temp2));

    blob_reset(&temp1);
    blob_reset(&temp2);
    blob_reset(&cmd);
  }
}

/*
** Return true the disk file is identical to the Blob.  Return zero
** if the files differ in any way.
*/
static int file_same_as_blob(Blob *blob, const char *zDiskFile){
  Blob file;
  int rc = 0;
  if( blob_size(blob)!=file_size(zDiskFile, ExtFILE) ) return 0;
  blob_zero(&file);
  blob_read_from_file(&file, zDiskFile, ExtFILE);
  if( blob_size(&file)!=blob_size(blob) ){
    rc = 0;
  }else{
    rc = memcmp(blob_buffer(&file), blob_buffer(blob), blob_size(&file))==0;
  }
  blob_reset(&file);
  return rc;
}

/*
** Run a diff between the version zFrom and files on disk.  zFrom might
** be NULL which means to simply show the difference between the edited
** files on disk and the check-out on which they are based.
**
** Use the internal diff logic if zDiffCmd is NULL.  Otherwise call the
670
671
672
673
674
675
676

677
678

679
680
681
682
683
684
685
        continue;
      }
      if( srcid>0 ){
        content_get(srcid, &content);
      }else{
        blob_zero(&content);
      }

      diff_print_index(zPathname, pCfg, pOut);
      diff_file(&content, zFullName, zPathname, pCfg, pOut);

      blob_reset(&content);
    }
    blob_reset(&fname);
  }
  db_finalize(&q);
  db_end_transaction(1);  /* ROLLBACK */
}







>
|
|
>







689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
        continue;
      }
      if( srcid>0 ){
        content_get(srcid, &content);
      }else{
        blob_zero(&content);
      }
      if( isChnged==0 || !file_same_as_blob(&content, zFullName) ){
        diff_print_index(zPathname, pCfg, pOut);
        diff_file(&content, zFullName, zPathname, pCfg, pOut);
      }
      blob_reset(&content);
    }
    blob_reset(&fname);
  }
  db_finalize(&q);
  db_end_transaction(1);  /* ROLLBACK */
}