Fossil SCM
Remove redundant use of chnged column/variable. The SELECT statement already ensures each row has chnged==1, so there is no need to check it repeatedly.
Commit
be25d412f149e591f4aae69bc780984baa95a0de
Parent
209da9bced807ae…
1 file changed
+5
-6
+5
-6
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1900,11 +1900,11 @@ | ||
| 1900 | 1900 | /* Step 2: Insert records for all modified files into the blob |
| 1901 | 1901 | ** table. If there were arguments passed to this command, only |
| 1902 | 1902 | ** the identified files are inserted (if they have been modified). |
| 1903 | 1903 | */ |
| 1904 | 1904 | db_prepare(&q, |
| 1905 | - "SELECT id, %Q || pathname, mrid, %s, chnged, %s, %s FROM vfile " | |
| 1905 | + "SELECT id, %Q || pathname, mrid, %s, %s, %s FROM vfile " | |
| 1906 | 1906 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1907 | 1907 | g.zLocalRoot, |
| 1908 | 1908 | glob_expr("pathname", db_get("crnl-glob","")), |
| 1909 | 1909 | glob_expr("pathname", db_get("binary-glob","")), |
| 1910 | 1910 | glob_expr("pathname", db_get("encoding-glob","")) |
| @@ -1911,19 +1911,18 @@ | ||
| 1911 | 1911 | ); |
| 1912 | 1912 | while( db_step(&q)==SQLITE_ROW ){ |
| 1913 | 1913 | int id, rid; |
| 1914 | 1914 | const char *zFullname; |
| 1915 | 1915 | Blob content; |
| 1916 | - int crnlOk, binOk, encodingOk, chnged; | |
| 1916 | + int crnlOk, binOk, encodingOk; | |
| 1917 | 1917 | |
| 1918 | 1918 | id = db_column_int(&q, 0); |
| 1919 | 1919 | zFullname = db_column_text(&q, 1); |
| 1920 | 1920 | rid = db_column_int(&q, 2); |
| 1921 | 1921 | crnlOk = db_column_int(&q, 3); |
| 1922 | - chnged = db_column_int(&q, 4); | |
| 1923 | - binOk = db_column_int(&q, 5); | |
| 1924 | - encodingOk = db_column_int(&q, 6); | |
| 1922 | + binOk = db_column_int(&q, 4); | |
| 1923 | + encodingOk = db_column_int(&q, 5); | |
| 1925 | 1924 | |
| 1926 | 1925 | blob_zero(&content); |
| 1927 | 1926 | if( file_wd_islink(zFullname) ){ |
| 1928 | 1927 | /* Instead of file content, put link destination path */ |
| 1929 | 1928 | blob_read_link(&content, zFullname); |
| @@ -1933,11 +1932,11 @@ | ||
| 1933 | 1932 | /* Do not emit any warnings when they are disabled. */ |
| 1934 | 1933 | if( !noWarningFlag ){ |
| 1935 | 1934 | abortCommit |= commit_warning(&content, crnlOk, binOk, |
| 1936 | 1935 | encodingOk, zFullname); |
| 1937 | 1936 | } |
| 1938 | - if( chnged==1 && contains_merge_marker(&content) ){ | |
| 1937 | + if( contains_merge_marker(&content) ){ | |
| 1939 | 1938 | Blob fname; /* Relative pathname of the file */ |
| 1940 | 1939 | |
| 1941 | 1940 | nConflict++; |
| 1942 | 1941 | file_relative_name(zFullname, &fname, 0); |
| 1943 | 1942 | fossil_print("possible unresolved merge conflict in %s\n", |
| 1944 | 1943 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1900,11 +1900,11 @@ | |
| 1900 | /* Step 2: Insert records for all modified files into the blob |
| 1901 | ** table. If there were arguments passed to this command, only |
| 1902 | ** the identified files are inserted (if they have been modified). |
| 1903 | */ |
| 1904 | db_prepare(&q, |
| 1905 | "SELECT id, %Q || pathname, mrid, %s, chnged, %s, %s FROM vfile " |
| 1906 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1907 | g.zLocalRoot, |
| 1908 | glob_expr("pathname", db_get("crnl-glob","")), |
| 1909 | glob_expr("pathname", db_get("binary-glob","")), |
| 1910 | glob_expr("pathname", db_get("encoding-glob","")) |
| @@ -1911,19 +1911,18 @@ | |
| 1911 | ); |
| 1912 | while( db_step(&q)==SQLITE_ROW ){ |
| 1913 | int id, rid; |
| 1914 | const char *zFullname; |
| 1915 | Blob content; |
| 1916 | int crnlOk, binOk, encodingOk, chnged; |
| 1917 | |
| 1918 | id = db_column_int(&q, 0); |
| 1919 | zFullname = db_column_text(&q, 1); |
| 1920 | rid = db_column_int(&q, 2); |
| 1921 | crnlOk = db_column_int(&q, 3); |
| 1922 | chnged = db_column_int(&q, 4); |
| 1923 | binOk = db_column_int(&q, 5); |
| 1924 | encodingOk = db_column_int(&q, 6); |
| 1925 | |
| 1926 | blob_zero(&content); |
| 1927 | if( file_wd_islink(zFullname) ){ |
| 1928 | /* Instead of file content, put link destination path */ |
| 1929 | blob_read_link(&content, zFullname); |
| @@ -1933,11 +1932,11 @@ | |
| 1933 | /* Do not emit any warnings when they are disabled. */ |
| 1934 | if( !noWarningFlag ){ |
| 1935 | abortCommit |= commit_warning(&content, crnlOk, binOk, |
| 1936 | encodingOk, zFullname); |
| 1937 | } |
| 1938 | if( chnged==1 && contains_merge_marker(&content) ){ |
| 1939 | Blob fname; /* Relative pathname of the file */ |
| 1940 | |
| 1941 | nConflict++; |
| 1942 | file_relative_name(zFullname, &fname, 0); |
| 1943 | fossil_print("possible unresolved merge conflict in %s\n", |
| 1944 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1900,11 +1900,11 @@ | |
| 1900 | /* Step 2: Insert records for all modified files into the blob |
| 1901 | ** table. If there were arguments passed to this command, only |
| 1902 | ** the identified files are inserted (if they have been modified). |
| 1903 | */ |
| 1904 | db_prepare(&q, |
| 1905 | "SELECT id, %Q || pathname, mrid, %s, %s, %s FROM vfile " |
| 1906 | "WHERE chnged==1 AND NOT deleted AND is_selected(id)", |
| 1907 | g.zLocalRoot, |
| 1908 | glob_expr("pathname", db_get("crnl-glob","")), |
| 1909 | glob_expr("pathname", db_get("binary-glob","")), |
| 1910 | glob_expr("pathname", db_get("encoding-glob","")) |
| @@ -1911,19 +1911,18 @@ | |
| 1911 | ); |
| 1912 | while( db_step(&q)==SQLITE_ROW ){ |
| 1913 | int id, rid; |
| 1914 | const char *zFullname; |
| 1915 | Blob content; |
| 1916 | int crnlOk, binOk, encodingOk; |
| 1917 | |
| 1918 | id = db_column_int(&q, 0); |
| 1919 | zFullname = db_column_text(&q, 1); |
| 1920 | rid = db_column_int(&q, 2); |
| 1921 | crnlOk = db_column_int(&q, 3); |
| 1922 | binOk = db_column_int(&q, 4); |
| 1923 | encodingOk = db_column_int(&q, 5); |
| 1924 | |
| 1925 | blob_zero(&content); |
| 1926 | if( file_wd_islink(zFullname) ){ |
| 1927 | /* Instead of file content, put link destination path */ |
| 1928 | blob_read_link(&content, zFullname); |
| @@ -1933,11 +1932,11 @@ | |
| 1932 | /* Do not emit any warnings when they are disabled. */ |
| 1933 | if( !noWarningFlag ){ |
| 1934 | abortCommit |= commit_warning(&content, crnlOk, binOk, |
| 1935 | encodingOk, zFullname); |
| 1936 | } |
| 1937 | if( contains_merge_marker(&content) ){ |
| 1938 | Blob fname; /* Relative pathname of the file */ |
| 1939 | |
| 1940 | nConflict++; |
| 1941 | file_relative_name(zFullname, &fname, 0); |
| 1942 | fossil_print("possible unresolved merge conflict in %s\n", |
| 1943 |