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.

andygoth 2015-05-15 16:49 trunk
Commit be25d412f149e591f4aae69bc780984baa95a0de
1 file changed +5 -6
+5 -6
--- src/checkin.c
+++ src/checkin.c
@@ -1900,11 +1900,11 @@
19001900
/* Step 2: Insert records for all modified files into the blob
19011901
** table. If there were arguments passed to this command, only
19021902
** the identified files are inserted (if they have been modified).
19031903
*/
19041904
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 "
19061906
"WHERE chnged==1 AND NOT deleted AND is_selected(id)",
19071907
g.zLocalRoot,
19081908
glob_expr("pathname", db_get("crnl-glob","")),
19091909
glob_expr("pathname", db_get("binary-glob","")),
19101910
glob_expr("pathname", db_get("encoding-glob",""))
@@ -1911,19 +1911,18 @@
19111911
);
19121912
while( db_step(&q)==SQLITE_ROW ){
19131913
int id, rid;
19141914
const char *zFullname;
19151915
Blob content;
1916
- int crnlOk, binOk, encodingOk, chnged;
1916
+ int crnlOk, binOk, encodingOk;
19171917
19181918
id = db_column_int(&q, 0);
19191919
zFullname = db_column_text(&q, 1);
19201920
rid = db_column_int(&q, 2);
19211921
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);
19251924
19261925
blob_zero(&content);
19271926
if( file_wd_islink(zFullname) ){
19281927
/* Instead of file content, put link destination path */
19291928
blob_read_link(&content, zFullname);
@@ -1933,11 +1932,11 @@
19331932
/* Do not emit any warnings when they are disabled. */
19341933
if( !noWarningFlag ){
19351934
abortCommit |= commit_warning(&content, crnlOk, binOk,
19361935
encodingOk, zFullname);
19371936
}
1938
- if( chnged==1 && contains_merge_marker(&content) ){
1937
+ if( contains_merge_marker(&content) ){
19391938
Blob fname; /* Relative pathname of the file */
19401939
19411940
nConflict++;
19421941
file_relative_name(zFullname, &fname, 0);
19431942
fossil_print("possible unresolved merge conflict in %s\n",
19441943
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button