Fossil

Check-in [2808e225]
Login

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

Overview
Comment:When committing on Windows with the "l" manifest flag set, update the symlink permission for selected files from the manifest.symlinks file if it exists
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | enhanced-symlink
Files: files | file ages | folders
SHA3-256:2808e225964e5030e6329ff6dfcf662d7bc0ecdbdb3bc2b9635390831c4dec09
User & Date: andygoth 2017-10-14 21:13:39
Context
2017-10-14
21:32
Move manifest.symlinks read functionality into the new get_checkout_symlink_table() function in checkout.c check-in: 7a4bd5cf user: andygoth tags: enhanced-symlink
21:13
When committing on Windows with the "l" manifest flag set, update the symlink permission for selected files from the manifest.symlinks file if it exists check-in: 2808e225 user: andygoth tags: enhanced-symlink
19:32
Correct help text for open command check-in: 109c956f user: andygoth tags: enhanced-symlink
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/checkin.c.

1497
1498
1499
1500
1501
1502
1503




































1504
1505
1506
1507
1508
1509
1510
....
1551
1552
1553
1554
1555
1556
1557

1558








1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
  int nBasename;              /* Size of base filename */
  Stmt q;                     /* Various queries */
  Blob mcksum;                /* Manifest checksum */
  ManifestFile *pFile;        /* File from the baseline */
  int nFBcard = 0;            /* Number of B-cards and F-cards */
  int i;                      /* Loop counter */
  const char *zColor;         /* Modified value of p->zColor */





































  assert( pBaseline==0 || pBaseline->zBaseline==0 );
  assert( pBaseline==0 || zBaselineUuid!=0 );
  blob_zero(pOut);
  if( vid ){
    zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d AND "
      "EXISTS(SELECT 1 FROM event WHERE event.type='ci' and event.objid=%d)",
................................................................................
    int isSelected = db_column_int(&q, 6);
    const char *zPerm;
    int cmp;

    blob_resize(&filename, nBasename);
    blob_append(&filename, zName, -1);


#if !defined(_WIN32)








    /* For unix, extract the "executable" and "symlink" permissions
    ** directly from the filesystem.  On windows, permissions are
    ** unchanged from the original.  However, only do this if the file
    ** itself is actually selected to be part of this check-in.
    */
    if( isSelected ){
      int mPerm;

      mPerm = file_wd_perm(blob_str(&filename));
      isExe = ( mPerm==PERM_EXE );
      isLink = ( mPerm==PERM_LNK );







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







 







>
|
>
>
>
>
>
>
>
>


|
<







1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
....
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606

1607
1608
1609
1610
1611
1612
1613
  int nBasename;              /* Size of base filename */
  Stmt q;                     /* Various queries */
  Blob mcksum;                /* Manifest checksum */
  ManifestFile *pFile;        /* File from the baseline */
  int nFBcard = 0;            /* Number of B-cards and F-cards */
  int i;                      /* Loop counter */
  const char *zColor;         /* Modified value of p->zColor */

#ifdef _WIN32
  /* On Windows, if the "manifest" setting contains the "l" flag, get the
   * symlink status bits from the "manifest.symlinks" file. */
  int manifestSymlinks = db_get_manifest_setting() & MFESTFLG_SYMLINKS;
  if( manifestSymlinks ){
    char *zFile = mprintf("%smanifest.symlinks", g.zLocalRoot);
    if( file_wd_size(zFile)>=0 ){
      /* If the file exists, read its contents into a temporary table. */
      char *zLine, *zEnd;
      Blob content = BLOB_INITIALIZER;
      blob_read_from_file(&content, zFile);
      blob_append(&content, "\n", 2);
      db_multi_exec("CREATE TEMP TABLE symlink(filename TEXT PRIMARY KEY %s)",
                    filename_collation());
      zLine = blob_buffer(&content);
      while( *zLine ){
        /* Find end of line and replace with NUL. */
        for( zEnd = zLine; *zEnd!='\r' && *zEnd!='\n'; ++zEnd );
        *zEnd = 0;

        /* If not a blank line, insert filename into symlink table. */
        if( *zLine ){
          db_multi_exec("INSERT OR IGNORE INTO symlink VALUES(%Q)", zLine);
        }

        /* Find start of next line, or find terminating NUL at end of file. */
        for( zLine = zEnd+1; *zLine=='\r' || *zLine=='\n'; ++zLine );
      }
      blob_reset(&content);
    }else{
      /* If the file is nonexistent, pretend the "l" flag was not specified. */
      manifestSymlinks = 0;
    }
  }
#endif

  assert( pBaseline==0 || pBaseline->zBaseline==0 );
  assert( pBaseline==0 || zBaselineUuid!=0 );
  blob_zero(pOut);
  if( vid ){
    zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d AND "
      "EXISTS(SELECT 1 FROM event WHERE event.type='ci' and event.objid=%d)",
................................................................................
    int isSelected = db_column_int(&q, 6);
    const char *zPerm;
    int cmp;

    blob_resize(&filename, nBasename);
    blob_append(&filename, zName, -1);

    /* Potentially update the permissions of files selected to be checked in. */
#ifdef _WIN32
    /* For Windows, if the "manifest" setting contains the "l" flag and the
    ** "manifest.symlinks" file exists, use its contents to determine which
    ** files do and do not have the "symlink" permission.
    */
    if( isSelected && manifestSymlinks ){
      isLink = db_exists("SELECT 1 FROM symlink WHERE filename=%Q", zName);
    }
#else
    /* For unix, extract the "executable" and "symlink" permissions
    ** directly from the filesystem.  On windows, permissions are
    ** unchanged from the original.

    */
    if( isSelected ){
      int mPerm;

      mPerm = file_wd_perm(blob_str(&filename));
      isExe = ( mPerm==PERM_EXE );
      isLink = ( mPerm==PERM_LNK );